Imported Upstream version 0.1
Devon Kearns
11 years ago
0 | #!/usr/bin/ruby | |
1 | require 'rubygems' | |
2 | require 'openssl' | |
3 | require 'base64' | |
4 | ||
5 | ||
6 | encrypted_data = "j1Uyj3Vx8TY9LtLZil2uAuZkFQA/4latT76ZwgdHdhw" | |
7 | ||
8 | def decrypt(encrypted_data) | |
9 | padding = "=" * (4 - (encrypted_data.length % 4)) | |
10 | epassword = "#{encrypted_data}#{padding}" | |
11 | decoded = Base64.decode64(epassword) | |
12 | ||
13 | key = "\x4e\x99\x06\xe8\xfc\xb6\x6c\xc9\xfa\xf4\x93\x10\x62\x0f\xfe\xe8\xf4\x96\xe8\x06\xcc\x05\x79\x90\x20\x9b\x09\xa4\x33\xb6\x6c\x1b" | |
14 | aes = OpenSSL::Cipher::Cipher.new("AES-256-CBC") | |
15 | aes.decrypt | |
16 | aes.key = key | |
17 | plaintext = aes.update(decoded) | |
18 | plaintext << aes.final | |
19 | pass = plaintext.unpack('v*').pack('C*') # UNICODE conversion | |
20 | ||
21 | return pass | |
22 | end | |
23 | ||
24 | blah = decrypt(encrypted_data) | |
25 | puts blah |