lib/enc.rb in no-style-please2-plugins-0.5.0 vs lib/enc.rb in no-style-please2-plugins-0.5.1

- old
+ new

@@ -56,15 +56,21 @@ return "#{key}" end end module EncFilter + $KeyMap = {} def genKey(password) + cacheKey = $KeyMap[password] + if cacheKey + return cacheKey + end salt = 'this is a salt string 20221019' iter = 12345 key_len = 32 key = OpenSSL::KDF.pbkdf2_hmac(password, salt: salt, iterations: iter, length: key_len, hash: "sha256") + $KeyMap[password] = key return key end def encrypt(msg,password) cipher = OpenSSL::Cipher::AES.new(256, :GCM).encrypt \ No newline at end of file