Class: CoBreak::Cipher::Base32

Inherits:
Object
  • Object
show all
Defined in:
ext/cobreak/cobreak_cipher.c

Class Method Summary collapse

Class Method Details

.decode(full) ⇒ Object



88
89
90
91
92
93
94
95
96
97
98
# File 'ext/cobreak/cobreak_cipher.c', line 88

VALUE b32_decode(VALUE self, VALUE full) {
    char *myb32 = RSTRING_PTR(full);
    char strb32[1024] = "";
    char *clrdst = strb32;

    // Decodificar
    int decoded_length = decodeblock32(myb32, clrdst);
    clrdst[decoded_length] = '\0'; // Asegurar que la cadena esté terminada

    return rb_str_new2(strb32);
}

.encode(full) ⇒ Object

Define method for class Base32



128
129
130
131
132
133
134
135
136
# File 'ext/cobreak/cobreak_cipher.c', line 128

VALUE b32_encode(VALUE self, VALUE full) {
    char *strb32 = RSTRING_PTR(full);
    char myb32[1024] = "";
    char *clrdst = myb32;

   encodeblock32(strb32, strlen(strb32), clrdst);

    return rb_str_new2(myb32);
}