Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

encrypted_strings

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

encrypted_strings

  • 0.3.3
  • Rubygems
  • Socket score

Version published
Maintainers
1
Created
Source

= encrypted_strings

+encrypted_strings+ provides dead-simple string encryption/decryption syntax.

== Resources

API

  • http://api.pluginaweek.org/encrypted_strings

Bugs

Development

Source

  • git://github.com/pluginaweek/encrypted_strings.git

== Description

Encrypting and decrypting data is not exactly the most straightforward and DRY way. encrypted_strings improves the syntax and reduces the complexity, adding straightforward support for encrypting values using SHA-1, Symmetric, and Asymmetric ciphers.

== Usage

=== SHA Encryption

password = 'shhhh' => "shhhh" encrypted_password = password.encrypt => "66c85d26dadde7e1db27e15a0776c921e27143bd" encrypted_password.class => String encrypted_password.cipher => #<EncryptedStrings::ShaCipher:0x2b9238889460 @salt="salt"> encrypted_password == 'shhhh' => true encrypted_password.decrypt NotImplementedError: Decryption is not supported using a(n) EncryptedStrings::ShaCipher from ./script/../config/../config/../vendor/plugins/encrypted_strings/lib/encrypted_strings/cipher.rb:13:in decrypt' from ./script/../config/../config/../vendor/plugins/encrypted_strings/lib/encrypted_strings/extensions/string.rb:52:in decrypt' from (irb):40

When encrypt is called, it creates a +cipher+ instance which is used for future encryption and decryption of the string. The default cipher uses SHA-1 encryption. For ciphers that do not support decryption, equality with other strings is tested by encrypting the other string and checking whether the resulting encrypted value is the same.

=== Symmetric Encryption

password = 'shhhh' => "shhhh" crypted_password = password.encrypt(:symmetric, :password => 'secret_key') => "qSg8vOo6QfU=\n" crypted_password.class => String crypted_password == 'shhhh' => true password = crypted_password.decrypt => "shhhh"

=== Asymmetric encryption

password = 'shhhh' => "shhhh" crypted_password = password.encrypt(:asymmetric, :public_key_file => './public.key', :private_key_file => './private.key') => "NEwVzcikYUKfS8HTc9L9eg/dMxBCLZ/nFr7J1aQYjkl3I2MPUD0lmjr/saC6\nTJEPwOl60Ki24H8TUwnGtZy14A==\n" crypted_password.class => String crypted_password == 'shhhh' => true password = crypted_password.decrypt => "shhhh"

== Dependencies

None.

== References

FAQs

Package last updated on 07 Mar 2010

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc