Skip to content

Instantly share code, notes, and snippets.

@roadhouse
Last active November 11, 2024 17:45
Show Gist options
  • Save roadhouse/2b02dc51c0be370acf1972d598c2984c to your computer and use it in GitHub Desktop.
Save roadhouse/2b02dc51c0be370acf1972d598c2984c to your computer and use it in GitHub Desktop.
def xor_encrypt(string, key)
string.bytes.map.with_index { |byte, index| (byte ^ key.bytes[index % key.length]).chr }.join
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment