Simple Encryption in Ruby without external gems

前端 未结 9 946
庸人自扰
庸人自扰 2020-12-08 07:43

I need a simple encryption for some text strings. I want to create coupon codes and make them look cool so subsequently created code should look very different. (And besides

9条回答
  •  没有蜡笔的小新
    2020-12-08 08:23

    I know that you are looking for a no-gem encryption, but still want to offer to those who are here and don't worry about using external gems. Try glogin (I'm the author):

    require 'glogin/codec'
    codec = GLogin:Codec.new('the secret')
    encrypted = codec.encrypt('Hello, world!')
    decrypted = codec.decrypt(encrypted)
    

    It's based on OpenSSL and Base58.

提交回复
热议问题