Class: RubyClangFpe::Fpe1Key
- Inherits:
-
FpeKey
- Object
- FpeKey
- RubyClangFpe::Fpe1Key
show all
- Defined in:
- ext/ruby_clang_fpe/ruby_clang_fpe.c
Instance Method Summary
collapse
Methods inherited from FpeKey
generate_ff1_key, generate_ff3_1_key, generate_ff3_key, generate_key, #radix, #tweak
Instance Method Details
#decrypt(ciphertext) ⇒ Object
85
86
87
88
89
90
91
92
|
# File 'ext/ruby_clang_fpe/ruby_clang_fpe.c', line 85
static VALUE t_ff1_decrypt(VALUE self, VALUE ciphertext)
{
FPE_KEY *fpe_key_ptr;
TypedData_Get_Struct(self, FPE_KEY, &fpe_type, fpe_key_ptr);
char plaintext[strlen(StringValueCStr(ciphertext))];
FPE_ff1_decrypt(StringValueCStr(ciphertext), plaintext, fpe_key_ptr);
return rb_str_new_cstr(plaintext);
};
|
#encrypt(plaintext) ⇒ Object
76
77
78
79
80
81
82
83
|
# File 'ext/ruby_clang_fpe/ruby_clang_fpe.c', line 76
static VALUE t_ff1_encrypt(VALUE self, VALUE plaintext)
{
FPE_KEY *fpe_key_ptr;
TypedData_Get_Struct(self, FPE_KEY, &fpe_type, fpe_key_ptr);
char ciphertext[strlen(StringValueCStr(plaintext))];
FPE_ff1_encrypt(StringValuePtr(plaintext), ciphertext, fpe_key_ptr);
return rb_str_new_cstr(ciphertext);
};
|