lib/enc.rb in no-style-please2-plugins-0.2.0.2 vs lib/enc.rb in no-style-please2-plugins-0.3.0
- old
+ new
@@ -61,11 +61,12 @@
key = getKey(content,page)
r = key != nil && key.length > 0
return r ? "1":""
end
- def contentEncrypt(content,page)
+ def contentEncrypt(content,page,prefix)
keyOri = getKey(content,page)
+ keyOri = prefix + keyOri + prefix
key = Digest::MD5.hexdigest(keyOri).downcase()
iv = Digest::MD5.hexdigest(content).downcase()
ivHex = iv[0...16]
iv = ivHex.scan(/../).map { |x| x.hex.chr }.join
encryptor = Salsa20.new(key, iv)
\ No newline at end of file