Class: CoBreak::Cipher::Cesar
- Inherits:
-
Object
- Object
- CoBreak::Cipher::Cesar
- Defined in:
- ext/cobreak/cobreak_cipher.c
Class Method Summary collapse
- .decode(str, shift) ⇒ Object
-
.encode(str, shift) ⇒ Object
Define method for class Cesar.
Class Method Details
.decode(str, shift) ⇒ Object
249 250 251 252 253 254 255 256 257 |
# File 'ext/cobreak/cobreak_cipher.c', line 249
VALUE cesar_decode(VALUE self, VALUE str, VALUE shift) {
char *input = RSTRING_PTR(str);
char output[1024]; // Buffer para la salida
int shift_value = NUM2INT(shift);
decodeblock_cesar(input, output, shift_value);
return rb_str_new2(output);
}
|
.encode(str, shift) ⇒ Object
Define method for class Cesar
238 239 240 241 242 243 244 245 246 |
# File 'ext/cobreak/cobreak_cipher.c', line 238
VALUE cesar_encode(VALUE self, VALUE str, VALUE shift) {
char *input = RSTRING_PTR(str);
char output[1024]; // Buffer para la salida
int shift_value = NUM2INT(shift);
encodeblock_cesar(input, output, shift_value);
return rb_str_new2(output);
}
|