Created
March 24, 2011 20:59
-
-
Save laserlemon/885872 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| # Initialize new Triple DES, CBC cipher with PKCS5 padding | |
| cipher = Cipher.new | |
| # Begin | |
| cipher.encrypt | |
| # Pass in encryption key, as given: "...rbtrj" | |
| cipher.key = "KEY" | |
| # Pass in initialization vector, as given: "...gdf=" | |
| cipher.iv = "IV" | |
| # Encrypt the timestamp alone | |
| encrypted = cipher.update("20110323102422") | |
| # Finish the encryption | |
| encrypted << cipher.final | |
| # Return the base 64 encoded result | |
| Base64.encode64(encrypted) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment