Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Ruby C
branch: master
Failed to load latest commit information.
ext/xor
lib Updated to build on ruby 2.0.0 (fixes #5), various cleanup.
spec Fix for heap strings.
.gitignore Updated to build on ruby 2.0.0 (fixes #5), various cleanup.
Gemfile Updated dev gems, bumped version.
Gemfile.lock Updated dev gems, bumped version.
MIT-LICENSE Initial import (from old ODIN project).
README.rdoc Updated benchmark.
Rakefile Updated build system.
benchmark Updated benchmark.
fast_xor.gemspec Updated dev gems, bumped version.
fast_xor.kdev4 Updates: Ruby 1.9, Bundler, rake-compiler, RSpec, KDevelop4.

README.rdoc

String XOR Ruby Extension

fast_xor is a simple extension which provides fast in-place String XOR functions, suitable for cryptography.

How do you use it?

require 'xor'

# two-argument version
a, b = 'a string', 'another string'
a.xor!(b)
a == "\000N\034\000\032\f\034G"

# three-argument version
a, b, c = 'a string', 'another string', 'yet another string'
a.xor!(b, c)
a == "y+h {bs3"

How fast is “Fast”?

Over 5,000x faster than pure Ruby, on my machine (your mileage my vary):

$ ./benchmark
            user     system      total        real
Ruby     :  4.530000   0.000000   4.530000 (  4.535203)
C (x1000):  0.780000   0.000000   0.780000 (  0.781100)

Author

Steve Sloan (steve@finagle.org)

Website

github.com/CodeMonkeySteve/fast_xor

Copyright

Copyright © 2009-2013 Steve Sloan

License

MIT

Something went wrong with that request. Please try again.