I used danpal/attr_encryptor gem to encrypt some attribute in my ActiveRecord model.
attr_encrypted :number, :charset => 'UTF-8', :key => 'vasya pupkin'
and got following error
OpenSSL::Cipher::CipherError: bad decrypt
Then I tried to use encrypt_number in rails console and seen different values for the same value of 'number' field when I restarted console. Why?
rails c
CreditCard.encrypt_number('hello')
"tRO0BETHrh5J3gXv8WVntw==\n"
quit
rails c
CreditCard.encrypt_number('hello')
"kJSbe30RQyR+gy3oDXv5ZA==\n"