Skip to content

Instantly share code, notes, and snippets.

View carlosjhr64's full-sized avatar
🏠
At home

Carlos J. Hernandez carlosjhr64

🏠
At home
View GitHub Profile
@carlosjhr64
carlosjhr64 / onepass.rb
Created September 29, 2011 18:25
xor strings onepass secrets
def onepass( target, *secrets )
output = target
secrets.select{|sec| !sec.nil?}.each do |secret|
output = output.bytes.inject(''){|string,byte| string + (byte^(secret[string.length] || 0.chr).ord).chr }
end
output
end