Rubyã§æå·åãããã¼ã¿ãJavaã§å¾©å·åãã¾ããã®éãè¡ã£ã¦ã¿ãã ä»åã¯AES128ãããã®æå·åã¢ã¼ãCBCãããã£ã³ã°ã¯PKCS#5ã§å®æ½ã ã¾ãRubyå´ã®ã³ã¼ãã require 'openssl' require 'base64' class CryptUtil def self.encrypt(pass, value) enc = OpenSSL::Cipher.new('aes-128-cbc') # æå·åor復å·åã©ã¡ããè¡ããã»ããï¼ä»åã¯æå·åï¼ã復å·åã®å ´åã¯decrypt enc.encrypt # ivãçæ iv = OpenSSL::Random.random_bytes(16) # æå·åããéã®ãã¼æååãã»ãã enc.key = pass # ivãã»ãã enc.iv = iv crypted = "" crypted << enc.upda
{{#tags}}- {{label}}
{{/tags}}