-
Notifications
You must be signed in to change notification settings - Fork 66
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add result of matrix examples in README also change matrix_print func…
…tion for print matrix more precise
- Loading branch information
1 parent
0c70589
commit a775d18
Showing
11 changed files
with
527 additions
and
80 deletions.
There are no files selected for viewing
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
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
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 |
---|---|---|
@@ -1,34 +1,17 @@ | ||
#include <stdlib.h> | ||
#include <string.h> | ||
#include "matrix/matrix.h" | ||
#include "fmt/fmt.h" | ||
#include "encoding/encoding.h" | ||
|
||
|
||
int main() { | ||
const char* input = "Hello, Base91!"; | ||
size_t input_length = strlen(input); | ||
Matrix* matrix = matrix_walsh(8); | ||
|
||
// Encoding | ||
char* encoded = encoding_base91_encode((const uint8_t*)input, input_length); | ||
if (!encoded) { | ||
fmt_fprintf(stderr, "Encoding failed.\n"); | ||
return 1; | ||
if (!matrix) { | ||
fmt_printf("Error in creation matrix object"); | ||
return -1; | ||
} | ||
|
||
fmt_printf("Encoded: %s\n", encoded); | ||
|
||
// Decoding | ||
size_t decoded_length; | ||
uint8_t* decoded = encoding_base91_decode(encoded, &decoded_length); | ||
|
||
if (!decoded) { | ||
fmt_fprintf(stderr, "Decoding failed.\n"); | ||
free(encoded); | ||
return 1; | ||
} | ||
fmt_printf("Decoded: %.*s\n", (int)decoded_length, decoded); | ||
fmt_printf("Matrix walsh is : \n"); | ||
matrix_print(matrix); | ||
|
||
free(encoded); | ||
free(decoded); | ||
matrix_deallocate(matrix); | ||
return 0; | ||
} |
Oops, something went wrong.