forked from flipperdevices/flipperzero-firmware
-
-
Notifications
You must be signed in to change notification settings - Fork 545
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
64 changed files
with
2,894 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# Auto detect text files and perform LF normalization | ||
* text=auto |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
# Prerequisites | ||
*.d | ||
|
||
# Object files | ||
*.o | ||
*.ko | ||
*.obj | ||
*.elf | ||
|
||
# Linker output | ||
*.ilk | ||
*.map | ||
*.exp | ||
|
||
# Precompiled Headers | ||
*.gch | ||
*.pch | ||
|
||
# Libraries | ||
*.lib | ||
*.a | ||
*.la | ||
*.lo | ||
|
||
# Shared objects (inc. Windows DLLs) | ||
*.dll | ||
*.so | ||
*.so.* | ||
*.dylib | ||
|
||
# Executables | ||
*.exe | ||
*.out | ||
*.app | ||
*.i*86 | ||
*.x86_64 | ||
*.hex | ||
|
||
# Debug files | ||
*.dSYM/ | ||
*.su | ||
*.idb | ||
*.pdb | ||
|
||
# Kernel Module Compile Results | ||
*.mod* | ||
*.cmd | ||
.tmp_versions/ | ||
modules.order | ||
Module.symvers | ||
Mkfile.old | ||
dkms.conf |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# Flipper-Zero-Crypto-Dictionary | ||
|
||
Cryptography Dictionary is a comprehensive reference tool that provides detailed info on various algorithms. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
#include "app.h" | ||
#include "../scenes/scenes.h" | ||
#include "../scenes/scene_manager.h" | ||
#include "../callbacks/callbacks.h" | ||
|
||
App* app_alloc() { | ||
App* app = calloc(1, sizeof(App)); | ||
app->file_stream = file_stream_alloc(furi_record_open(RECORD_STORAGE)); | ||
if(!app->file_stream) { | ||
free(app); | ||
return NULL; | ||
} | ||
app->scene_manager = scene_manager_alloc(&scene_manager_handlers, app); | ||
app->view_dispatcher = view_dispatcher_alloc(); | ||
view_dispatcher_enable_queue(app->view_dispatcher); | ||
view_dispatcher_set_event_callback_context(app->view_dispatcher, app); | ||
view_dispatcher_set_navigation_event_callback( | ||
app->view_dispatcher, back_event_callback); | ||
app->submenu = submenu_alloc(); | ||
view_dispatcher_add_view( | ||
app->view_dispatcher, SubmenuView, submenu_get_view(app->submenu)); | ||
app->widget = widget_alloc(); | ||
view_dispatcher_add_view( | ||
app->view_dispatcher, WidgetView, widget_get_view(app->widget)); | ||
return app; | ||
} | ||
|
||
void app_free(App* app) { | ||
furi_assert(app); | ||
view_dispatcher_remove_view(app->view_dispatcher, SubmenuView); | ||
view_dispatcher_remove_view(app->view_dispatcher, WidgetView); | ||
scene_manager_free(app->scene_manager); | ||
view_dispatcher_free(app->view_dispatcher); | ||
submenu_free(app->submenu); | ||
widget_free(app->widget); | ||
stream_free(app->file_stream); | ||
free(app); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
#ifndef APP_H | ||
#define APP_H | ||
|
||
#include <gui/gui.h> | ||
#include <gui/view_dispatcher.h> | ||
#include <gui/modules/widget.h> | ||
#include <gui/modules/submenu.h> | ||
#include <gui/modules/text_input.h> | ||
|
||
#include <gui/scene_manager.h> | ||
#include <storage/filesystem_api_defines.h> | ||
#include <storage/storage.h> | ||
#include <toolbox/stream/stream.h> | ||
#include <toolbox/stream/file_stream.h> | ||
#include "../resource/resource.h" | ||
|
||
typedef struct App { | ||
SceneManager* scene_manager; | ||
ViewDispatcher* view_dispatcher; | ||
Submenu* submenu; | ||
Widget* widget; | ||
const char* current_topic; | ||
size_t current_chapter_index; | ||
Stream* file_stream; | ||
} App; | ||
|
||
|
||
App* app_alloc(); | ||
void app_free(App* app); | ||
|
||
#endif // APP_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
App( | ||
appid="crypto_dict", | ||
name="Crypto Dictionary", | ||
apptype=FlipperAppType.EXTERNAL, | ||
entry_point="crypto_dict_app", | ||
requires=["gui", "storage"], | ||
stack_size=10 * 1024, | ||
fap_icon="icons/crypto_dict_icon.png", | ||
fap_category="Media", | ||
fap_icon_assets="icons", | ||
fap_file_assets="resources", | ||
fap_author="@armixz", | ||
fap_weburl="https://github.com/armixz/Flipper-Zero-Crypto-Dictionary", | ||
fap_version="0.1", | ||
fap_description="Cryptography Dictionary (Flipper Zero Edition)", | ||
) |
38 changes: 38 additions & 0 deletions
38
non_catalog_apps/crypto_dictionary_book/buffer/dynamic_buffer.c
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
#include "dynamic_buffer.h" | ||
|
||
void dynamic_buffer_init(DynamicBuffer* buffer, size_t initial_capacity) { | ||
buffer->data = malloc(initial_capacity); | ||
buffer->size = 0; | ||
buffer->capacity = buffer->data ? initial_capacity : 0; | ||
} | ||
|
||
bool dynamic_buffer_grow(DynamicBuffer* buffer, size_t min_capacity) { | ||
size_t new_capacity = buffer->capacity > 0 ? buffer->capacity : 64; | ||
while(new_capacity < min_capacity) { | ||
new_capacity *= 2; | ||
} | ||
char* new_data = realloc(buffer->data, new_capacity); | ||
if(!new_data) return false; | ||
|
||
buffer->data = new_data; | ||
buffer->capacity = new_capacity; | ||
return true; | ||
} | ||
|
||
bool dynamic_buffer_append(DynamicBuffer* buffer, const char* src, size_t src_size) { | ||
if(buffer->size + src_size > buffer->capacity) { | ||
if(!dynamic_buffer_grow(buffer, buffer->size + src_size)) { | ||
return false; | ||
} | ||
} | ||
memcpy(buffer->data + buffer->size, src, src_size); | ||
buffer->size += src_size; | ||
return true; | ||
} | ||
|
||
void dynamic_buffer_free(DynamicBuffer* buffer) { | ||
free(buffer->data); | ||
buffer->data = NULL; | ||
buffer->size = 0; | ||
buffer->capacity = 0; | ||
} |
18 changes: 18 additions & 0 deletions
18
non_catalog_apps/crypto_dictionary_book/buffer/dynamic_buffer.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#ifndef DYNAMIC_BUFFER_H | ||
#define DYNAMIC_BUFFER_H | ||
|
||
#include "../app/app.h" | ||
|
||
typedef struct { | ||
char* data; | ||
size_t size; | ||
size_t capacity; | ||
} DynamicBuffer; | ||
|
||
|
||
void dynamic_buffer_init(DynamicBuffer* buffer, size_t initial_capacity); | ||
bool dynamic_buffer_grow(DynamicBuffer* buffer, size_t min_capacity); | ||
bool dynamic_buffer_append(DynamicBuffer* buffer, const char* src, size_t src_size); | ||
void dynamic_buffer_free(DynamicBuffer* buffer); | ||
|
||
#endif // DYNAMIC_BUFFER_H |
29 changes: 29 additions & 0 deletions
29
non_catalog_apps/crypto_dictionary_book/callbacks/callbacks.c
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#include "callbacks.h" | ||
#include "../resource/resource.h" | ||
#include "../scenes/scenes.h" | ||
#include <stdlib.h> | ||
|
||
void menu_callback(void* context, uint32_t index) { | ||
App* app = context; | ||
if(index < number_of_chapters) { | ||
app->current_chapter_index = index; | ||
scene_manager_next_scene(app->scene_manager, ChapterScene); | ||
} | ||
} | ||
|
||
void chapter_callback(void* context, uint32_t index) { | ||
App* app = (App*)context; | ||
size_t chapterIndex = app->current_chapter_index; | ||
Chapter currentChapter = chapters[chapterIndex]; | ||
|
||
if(index < currentChapter.number_of_topics) { | ||
app->current_topic = currentChapter.content[index].file_path; | ||
scene_manager_next_scene(app->scene_manager, TopicScene); | ||
} | ||
} | ||
|
||
bool back_event_callback(void* context) { | ||
furi_assert(context); | ||
App* app = context; | ||
return scene_manager_handle_back_event(app->scene_manager); | ||
} |
10 changes: 10 additions & 0 deletions
10
non_catalog_apps/crypto_dictionary_book/callbacks/callbacks.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#ifndef CALLBACKS_H | ||
#define CALLBACKS_H | ||
|
||
#include "../app/app.h" | ||
|
||
void menu_callback(void* context, uint32_t index); | ||
void chapter_callback(void* context, uint32_t index); | ||
bool back_event_callback(void* context); | ||
|
||
#endif // CALLBACKS_H |
8 changes: 8 additions & 0 deletions
8
non_catalog_apps/crypto_dictionary_book/constants/constants.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#ifndef CONSTANTS_H | ||
#define CONSTANTS_H | ||
|
||
#define WIDGET_WIDTH 126 | ||
#define WIDGET_HEIGHT 64 | ||
#define CHAR_WIDTH 1 | ||
|
||
#endif // CONSTANTS_H |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
#include <furi.h> | ||
#include "app/app.h" | ||
#include "scenes/scenes.h" | ||
|
||
int32_t crypto_dict_app(void* p); | ||
|
||
int main() { | ||
void* parameter = NULL; | ||
crypto_dict_app(parameter); | ||
return 0; | ||
} | ||
|
||
int32_t crypto_dict_app(void* p) { | ||
UNUSED(p); | ||
App* app = app_alloc(); | ||
Gui* gui = furi_record_open(RECORD_GUI); | ||
view_dispatcher_attach_to_gui(app->view_dispatcher, gui, ViewDispatcherTypeFullscreen); | ||
scene_manager_next_scene(app->scene_manager, MainMenuScene); | ||
view_dispatcher_run(app->view_dispatcher); | ||
app_free(app); | ||
return 0; | ||
} |
95 changes: 95 additions & 0 deletions
95
non_catalog_apps/crypto_dictionary_book/resource/resource.c
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
#include "resource.h" | ||
|
||
Topic symmetric_cipher[] = { | ||
{"1-Blowfish", NULL, APP_ASSETS_PATH("symmetric_cipher/blowfish.txt")}, | ||
{"2-Camellia", NULL, APP_ASSETS_PATH("symmetric_cipher/camellia.txt")}, | ||
{"3-CAST-128", NULL, APP_ASSETS_PATH("symmetric_cipher/cast128.txt")}, | ||
{"4-CAST-256", NULL, APP_ASSETS_PATH("symmetric_cipher/cast256.txt")}, | ||
{"5-DES", NULL, APP_ASSETS_PATH("symmetric_cipher/des.txt")}, | ||
{"6-IDEA", NULL, APP_ASSETS_PATH("symmetric_cipher/idea.txt")}, | ||
{"7-RC2", NULL, APP_ASSETS_PATH("symmetric_cipher/rc2.txt")}, | ||
{"8-RC4", NULL, APP_ASSETS_PATH("symmetric_cipher/rc4.txt")}, | ||
{"9-RC5", NULL, APP_ASSETS_PATH("symmetric_cipher/rc5.txt")}, | ||
{"10-RC6", NULL, APP_ASSETS_PATH("symmetric_cipher/rc6.txt")}, | ||
{"11-Serpent", NULL, APP_ASSETS_PATH("symmetric_cipher/serpent.txt")}, | ||
{"12-SM4", NULL, APP_ASSETS_PATH("symmetric_cipher/sm4.txt")}, | ||
{"13-Twofish", NULL, APP_ASSETS_PATH("symmetric_cipher/twofish.txt")}, | ||
{"14-Triple DES", NULL, APP_ASSETS_PATH("symmetric_cipher/des3.txt")}, | ||
}; | ||
|
||
// Topic public_key[] = { | ||
// {"1-DSA", NULL, APP_ASSETS_PATH("development.txt")}, | ||
// {"2-RSA", NULL, APP_ASSETS_PATH("development.txt")}, | ||
// }; | ||
|
||
// Topic key_agreement[] = { | ||
// {"1-DH", NULL, APP_ASSETS_PATH("development.txt")}, | ||
// }; | ||
|
||
// Topic certificates[] = { | ||
// {"1-X.509", NULL, APP_ASSETS_PATH("development.txt")}, | ||
// {"2-X.509v3", NULL, APP_ASSETS_PATH("development.txt")}, | ||
// }; | ||
|
||
// Topic hash_functions[] = { | ||
// {"1-MD2", NULL, APP_ASSETS_PATH("development.txt")}, | ||
// {"2-MD4", NULL, APP_ASSETS_PATH("development.txt")}, | ||
// {"3-MD5", NULL, APP_ASSETS_PATH("development.txt")}, | ||
// {"4-MDC2", NULL, APP_ASSETS_PATH("development.txt")}, | ||
// {"5-RIPEMD", NULL, APP_ASSETS_PATH("development.txt")}, | ||
// {"6-SHA", NULL, APP_ASSETS_PATH("development.txt")}, | ||
// }; | ||
|
||
// Topic authentication_codes[] = { | ||
// {"1-HMAC", NULL, APP_ASSETS_PATH("development.txt")}, | ||
// }; | ||
|
||
// Topic auxiliary_functions[] = { | ||
// {"1-ERR", NULL, APP_ASSETS_PATH("development.txt")}, | ||
// {"2-Threads", NULL, APP_ASSETS_PATH("development.txt")}, | ||
// {"3-RAND", NULL, APP_ASSETS_PATH("development.txt")}, | ||
|
||
// }; | ||
|
||
// Topic data_encoding[] = { | ||
// {"1-ASN1", NULL, APP_ASSETS_PATH("development.txt")}, | ||
// {"2-EVP", NULL, APP_ASSETS_PATH("development.txt")}, | ||
// {"3-PEM", NULL, APP_ASSETS_PATH("development.txt")}, | ||
// {"4-PKCS7", NULL, APP_ASSETS_PATH("development.txt")}, | ||
// {"5-PKCS12", NULL, APP_ASSETS_PATH("development.txt")}, | ||
// }; | ||
|
||
// Topic input_output[] = { | ||
// {"1-BIO", NULL, APP_ASSETS_PATH("development.txt")}, | ||
// }; | ||
|
||
// Topic internal_functions[] = { | ||
// {"1-BN", NULL, APP_ASSETS_PATH("development.txt")}, | ||
// {"2-Buffer", NULL, APP_ASSETS_PATH("development.txt")}, | ||
// {"3-EC", NULL, APP_ASSETS_PATH("development.txt")}, | ||
// {"4-LHASH", NULL, APP_ASSETS_PATH("development.txt")}, | ||
// {"5-Objects", NULL, APP_ASSETS_PATH("development.txt")}, | ||
// {"6-Stack", NULL, APP_ASSETS_PATH("development.txt")}, | ||
// {"7-TXT_DB", NULL, APP_ASSETS_PATH("development.txt")}, | ||
// }; | ||
|
||
Topic about[] = { | ||
// {"Algorithms", NULL, APP_ASSETS_PATH("about/algorithms.txt")}, | ||
{"GitHub", NULL, APP_ASSETS_PATH("about/github.txt")}, | ||
}; | ||
|
||
Chapter chapters[] = { | ||
{"1) Symmetric Cipher", symmetric_cipher, sizeof(symmetric_cipher) / sizeof(Topic)}, | ||
// {"2-Public Key", public_key, sizeof(public_key) / sizeof(Topic)}, | ||
// {"3-Key Agreement", key_agreement, sizeof(key_agreement) / sizeof(Topic)}, | ||
// {"4-Certificates", certificates, sizeof(certificates) / sizeof(Topic)}, | ||
// {"5-Hash Functions", hash_functions, sizeof(hash_functions) / sizeof(Topic)}, | ||
// {"6-Authentication Codes", authentication_codes, sizeof(authentication_codes) / sizeof(Topic)}, | ||
// {"7-Auxiliary Functions", auxiliary_functions, sizeof(auxiliary_functions) / sizeof(Topic)}, | ||
// {"8-Input/Output", input_output, sizeof(input_output) / sizeof(Topic)}, | ||
// {"9-Data Encoding", data_encoding, sizeof(data_encoding) / sizeof(Topic)}, | ||
// {"10-Internal Functions", internal_functions, sizeof(internal_functions) / sizeof(Topic)}, | ||
{"11) About", about, sizeof(about) / sizeof(Topic)}, | ||
}; | ||
|
||
const size_t number_of_chapters = sizeof(chapters) / sizeof(Chapter); |
Oops, something went wrong.