ruby
程序员文章站
2022-03-01 20:17:21
...
加密算法
require 'openssl' def data_decrypt(data, key) aes = OpenSSL::Cipher::Cipher.new("AES-128-CBC"); aes.decrypt; aes.key = key; aes.update(data) << aes.final end def data_save(data, file) File.open(file, 'a') { |f| f.write(data) } end def data_read(file) data = "" File.open(file) { |f| data = f.read } data end def data_exec(key, file) `ls file`.split("\n").map(&:strip).sort.each do |l| data = data_read(l) data = data_decrypt(data, key) data_save(data, file) end end data_exec("", file)
上一篇: 合约常见漏洞和代码风险
下一篇: 国内python第一步