Skip to content

Instantly share code, notes, and snippets.

@AhmedAliIbrahim
Last active March 16, 2017 08:04
Show Gist options
  • Save AhmedAliIbrahim/ba52643899f1ceae47f3279afbce95ac to your computer and use it in GitHub Desktop.
Save AhmedAliIbrahim/ba52643899f1ceae47f3279afbce95ac to your computer and use it in GitHub Desktop.
how to create a payfort signature !
# key is payfort passphrase request or response
def sign_with_key(params, key)
string_to_digest = params.sort { |a, b| a[0].upcase <=> b[0].upcase }.map { |k, v| "#{k}=#{v}" }.join()
string_to_digest = "#{key}#{string_to_digest}#{key}"
Digest::SHA256.hexdigest(string_to_digest)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment