Skip to content

Instantly share code, notes, and snippets.

@mctaylorpants
Created July 31, 2017 00:15
Show Gist options
  • Save mctaylorpants/7bb8ad730a53c5f77209a7e6a290ff3e to your computer and use it in GitHub Desktop.
Save mctaylorpants/7bb8ad730a53c5f77209a7e6a290ff3e to your computer and use it in GitHub Desktop.
def unmask_token(masked_token) # :doc:
one_time_pad = masked_token[0...AUTHENTICITY_TOKEN_LENGTH]
encrypted_csrf_token = masked_token[AUTHENTICITY_TOKEN_LENGTH..-1]
xor_byte_strings(one_time_pad, encrypted_csrf_token)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment