[go: up one dir, main page]

Skip to content

cloudwalk/ruby-3des

Repository files navigation

TDES

Ruby native extension for triple DES cryptography.

List all available rake tasks

rake --tasks

Generate Makefile

ruby ext/tdes/extconf.rb

Compile

rake clobber clean compile

Run tests

rake test

Or

RUBY_VERSION=3.0 $SHELL -c 'docker build --build-arg RUBY_VERSION=${RUBY_VERSION} -t ruby-app:${RUBY_VERSION} . && docker run -it --rm ruby-app:${RUBY_VERSION}'

Build local version

rake build

Build and Install local version

rake install

Install version from Rubygems

sudo gem install tdes

Push to Rubygems

  1. Change the code
  2. Change the VERSION file
  3. Run:
bundle install
  1. Push the code
  2. Open the PR
  3. Merge into master
  4. Pull master
  5. Run:
rake release

Linux

Having OpenSSL and Ruby installed, it should work out of the box.

MacOS

You may need to explicitly set your OpenSSL installation directory

rbenv:

export CFLAGS='-std=c99 -I ~/.rbenv/versions/3.0.2/openssl/include/'
export LDFLAGS='-lcrypto -L ~/.rbenv/versions/3.0.2/openssl/lib/'
rake clean compile

homebrew with asdf:

export CFLAGS="-std=c99 -I /opt/homebrew/opt/openssl@3.0/include/"
export LDFLAGS="-lcrypto -L /opt/homebrew/opt/openssl@3.0/lib/"
export CPPFLAGS="-I /opt/homebrew/opt/openssl@3.0/include"

Windows

lol

Examples

require 'rubygems'
require 'tdes'

key = '1111111111111111'
cipher = TDES::TDES.new(key)
encrypted = cipher.encrypt('12345678') # "\x85\x8B\x17m\xA8\xB1%\x03"
decrypted = cipher.decrypt(encrypted) # "12345678"

Copyright

MIT Licence. Copyright (c) 2022-2022 Cloudwalk.