Created
December 14, 2009 12:44
-
-
Save jmeridth/256022 to your computer and use it in GitHub Desktop.
ruby crypt/rijndael encryption gem test
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
>> require 'crypt/rijndael' | |
=> [] | |
>> require 'crypt' | |
=> [] | |
>> r = Crypt::Rijndael.new("pass123pass123pass123pass123pass","1234567890abcdef") | |
=> #<Crypt::Rijndael:0x2650fd4 @rounds=14, @round_keys=[[[112, 49, 97, 50], [97, 50, 115, 51], [115, 51, 115, 112], [115, 112, 49, 97]], [[115, 51, 115, 112], [115, 112, 49, 97], [49, 97, 50, 115], [50, 115, 51, 115]], [[158, 175, 206, 252], [238, 220, 175, 156], [252, 207, 188, 204], [34, 82, 99, 2]], [[195, 240, 131, 243], [173, 221, 236, 141], [122, 27, 41, 90], [69, 54, 5, 118]], [[193, 110, 160, 92], [80, 140, 35, 191], [196, 11, 183, 123], [47, 125, 30, 28]], [[137, 121, 250, 9], [165, 120, 148, 25], [91, 64, 105, 51], [217, 239, 234, 156]], [[17, 127, 223, 131], [147, 31, 60, 131], [26, 17, 166, 221], [46, 83, 77, 81]], [[101, 28, 230, 239], [73, 49, 165, 188], [154, 218, 179, 128], [8, 231, 13, 145]], [[124, 3, 220, 95], [94, 65, 125, 254], [155, 138, 44, 241], [241, 162, 239, 190]], [[170, 182, 80, 191], [242, 195, 102, 218], [59, 225, 82, 210], [166, 65, 76, 221]], [[59, 56, 228, 187], [235, 170, 215, 41], [90, 208, 252, 13], [249, 91, 180, 10]], [[64, 246, 166, 25], [87, 148, 242, 40], [236, 13, 95, 141], [193, 128, 204, 17]], [[47, 23, 243, 72], [182, 28, 203, 226], [216, 8, 244, 249], [45, 118, 194, 200]], [[18, 228, 66, 91], [207, 91, 169, 129], [117, 120, 39, 170], [41, 169, 101, 116]], [[99, 116, 135, 207], [26, 6, 205, 47], [74, 66, 182, 79], [20, 98, 160, 104]]], @shift_index=0, @key=[[99, 116, 135, 207, 152, 124, 62, 101], [26, 6, 205, 47, 218, 129, 40, 169], [74, 66, 182, 79, 241, 137, 174, 4], [20, 98, 160, 104, 108, 197, 160, 212]], @key_words=8, @vector="1234567890abcdef", @block_words=4, @block_size=16> | |
>> r.encrypt_block("1234567890abcdef") | |
=> "<\025\t\274\231R|wÝ\030\226\221ɬ\023" | |
>> x = r.encrypt_block("1234567890abcdef") | |
=> "<\025\t\274\231R|wÝ\030\226\221ɬ\023" | |
>> Base64.b64encode(x) | |
PBUJvJlSfHfdFxiWkcmsEw== | |
=> "PBUJvJlSfHfdFxiWkcmsEw==\n" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment