⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 05 - strongly encrypting data.rb

📁 O Reilly Ruby Cookbook source code
💻 RB
字号:
require 'rubygems'require 'ezcrypto'plaintext = '24.9195N 17.821E'ezcrypto_key = EzCrypto::Key.with_password 'My secret key', 'salt string'ezcrypto_ciphertext = ezcrypto_key.encrypt(plaintext)# => "F\262\260\273\217\tR\351\362-\021-a\336\324Qc..."ezcrypto_key.decrypt(ezcrypto_ciphertext)# => "24.9195N 17.821E"#---require 'crypt/rijndael'aes_key = Crypt::Rijndael.new('My secret key')aes_cyphertext = aes_key.encrypt_string(plaintext)# => "\e\003\203\030]\203\t\346..."aes_key.decrypt_string(aes_cyphertext)# => "24.9195N 17.821E"#---# EzCrypto exampleblowfish_key = EzCrypto::Key.with_password('My secret password', 'salt string',                                           :algorithm=>'blowfish')# Crypt examplerequire 'crypt/blowfish'blowfish_key = Crypt::Blowfish.new('My secret password')#---

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -