Skip to content

TextSmuggler makes it easy to obfuscate pieces of text which need to be decoded later on using OpenSSL::Cipher. Possibly incorporated in a URL.

License

Notifications You must be signed in to change notification settings

mig-hub/text-smuggler

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Text Smuggler

TextSmuggler makes it easy to obfuscate pieces of text which need to be decoded later on, using OpenSSL::Cipher. Possibly incorporated in a URL.

Put this in your Gemfile:

gem 'text-smuggler'

Then use it like this:

secret_location = 'The secret location of Luke Skywalker is xxxxxx.'
han_solo = TextSmuggler.new key: 'change_me'

encoded = han_solo.encode secret_location

# Now you can use this string in a database or in a URL quite safely.
# And then when you need to decode it...

decoded = han_solo.decode encoded

You can also initialize a TextSmuggler with a specific type of ciper. The default is aes-256-cbc.

smuggler = TextSmuggler.new({
  key: 'change_me',
  cipher_type: 'aes-256-cbc'
})

For more details about OpenSSL::Cipher, you can read documentation here

Warning

Bear in mind that while this method is quite safe, you should only use it when you absolutely have to retrieve the data. For example, avoid saving passwords in a database with this method. Passwords only need to be compared and are safer if they are saved with a non-reversible method (i.e. Hashed and salted).

About

TextSmuggler makes it easy to obfuscate pieces of text which need to be decoded later on using OpenSSL::Cipher. Possibly incorporated in a URL.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages