💾 Archived View for gmi.noulin.net › gitRepositories › base64 › file › demo.c.gmi captured on 2024-08-19 at 04:00:53. Gemini links have been rewritten to link to archived content

View Raw

More Information

⬅️ Previous capture (2023-01-29)

-=-=-=-=-=-=-

base64

Log

Files

Refs

demo.c (1316B)

     1 #! /usr/bin/env sheepy
     2 /* or direct path to sheepy: #! /usr/local/bin/sheepy */
     3 
     4 /* Libsheepy documentation: https://spartatek.se/libsheepy/ */
     5 #include "libsheepyObject.h"
     6 #include "base64.h"
     7 
     8 int argc; char **argv;
     9 
    10 /* enable/disable logging */
    11 /* #undef pLog */
    12 /* #define pLog(...) */
    13 
    14 int main(int ARGC, char** ARGV) {
    15 
    16   argc = ARGC; argv = ARGV;
    17 
    18   initLibsheepy(ARGV[0]);
    19   setLogMode(LOG_DATE);
    20   //setLogSymbols(LOG_UTF8);
    21   //disableLibsheepyErrorLogs;
    22 
    23   u8 bytes[] = {0x96,0x5c,0xbc,0x5d,0x00,0x00,0x00,0x00,0xd6,0x45,0xd3,0xd3,0xd0,0x84,0x98,0xaa,0x18,0xd1,0xf3,0xc7,0xef,0x9c,0x8b,0x5c,0x89,0x8b,0xee,0x23,0x86,0xff,0x35,0xf9};
    24 
    25   u8 s[1024] = init0Var;
    26 
    27   var r = base64_encode(bytes, sizeof(bytes), s, sizeof(s));
    28 
    29   logVarG(sizeof(bytes));
    30   logVarG(r);
    31   logVarG(strlen(s));
    32   logVarG(base64_encode_size(sizeof(bytes)));
    33   logI(s);
    34 
    35   /* char *base64String = "lly8XQAAAADWRdPT0ISYqhjR88fvnItciYvuI4b/Nfk="; */
    36   char *base64String = s;
    37 
    38   u8 decoded[40];
    39 
    40   var size = base64_decode(base64String, decoded, sizeof(decoded));
    41 
    42   logVarG(size);
    43   logVarG(base64_decode_size(base64String));
    44   logI("Source: 256bits");
    45   loghex(  bytes, MIN(sizeof(decoded), sizeof(bytes)));
    46   put;
    47   logI("Decoded: 256bits");
    48   loghex(decoded, MIN(sizeof(decoded), sizeof(bytes)));
    49 
    50 }
    51 // vim: set expandtab ts=2 sw=2: