Skip to content

Commit

Permalink
Merge branch 'develop' into storage
Browse files Browse the repository at this point in the history
  • Loading branch information
xtruan committed Mar 6, 2023
2 parents de10564 + 1424655 commit 7507a66
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 1,106 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ The goal of this project is to see how much crypto functionality can be brought
## How to install on Flipper Zero
- If you do not have one, download a Flipper Zero firmware to get the `fbt` build tool
- Plug your Flipper Zero in via USB
- Copy the contents of this folder into the applications_user folder of your firmware
- Modify the `site_scons/cc.scons` file in the Flipper Zero firmware to remove the `"-Wdouble-promotion"` warning and add the `"-Os"` flag
- Copy the contents of this folder into the `applications_user` folder of your firmware
- Modify the `site_scons/cc.scons` file in the Flipper Zero firmware to add the `"-Os"` flag

Then run the command:
```
.\fbt COMPACT=1 DEBUG=0 launch_app APPSRC=applications_user/FlipBIP
./fbt COMPACT=1 DEBUG=0 launch_app APPSRC=applications_user/FlipBIP
```
The application will be compiled and copied onto your device

Expand Down
80 changes: 15 additions & 65 deletions helpers/flipbip_string.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
* SUCH DAMAGE.
*/
#include "flipbip_string.h"
// #include <string.h>
#include <ctype.h>
char *
flipbip_strtok(char *s, const char *delim)
Expand Down Expand Up @@ -77,67 +76,18 @@ flipbip_strtok_r(char *s, const char *delim, char **last)
}
/* NOTREACHED */
}
/* Copyright (c) 2012, The Linux Foundation. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials provided
* with the distribution.
* * Neither the name of The Linux Foundation nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
// void
// flipbip_strrev(unsigned char *str)
// {
// int i;
// int j;
// unsigned char a;
// unsigned len = strlen((const char *)str);
// for (i = 0, j = len - 1; i < j; i++, j--)
// {
// a = str[i];
// str[i] = str[j];
// str[j] = a;
// }
// }
// int
// flipbip_itoa(int num, unsigned char* str, int len, int base)
// {
// int sum = num;
// int i = 0;
// int digit;
// if (len == 0)
// return -1;
// do
// {
// digit = sum % base;
// if (digit < 0xA)
// str[i++] = '0' + digit;
// else
// str[i++] = 'A' + digit - 0xA;
// sum /= base;
// }while (sum && (i < (len - 1)));
// if (i == (len - 1) && sum)
// return -1;
// str[i] = '\0';
// flipbip_strrev(str);
// return 0;
// }


void
flipbip_btox(unsigned char i, char *str)
{
unsigned char n;

str += 2;
*str = '\0';

for (n = 2; n != 0; --n) {
*--str = "0123456789abcdef"[i & 0x0F];
i >>= 4;
}
}
4 changes: 2 additions & 2 deletions helpers/flipbip_string.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
char * flipbip_strtok(char *s, const char *delim);
char * flipbip_strtok_r(char *s, const char *delim, char **last);
// void flipbip_strrev(unsigned char *str);
// int flipbip_itoa(int num, unsigned char* str, int len, int base);

void flipbip_btox(unsigned char i, char *str);
Loading

0 comments on commit 7507a66

Please sign in to comment.