Answer the question
In order to leave comments, you need to log in
How to replace this piece of PHP code in Ruby?
There is a code in PHP that hashes the data:
<?php
$arHash = array(
$m_shop,
$m_orderid,
$m_amount,
$m_curr,
$m_desc,
$m_key
);
$sign = strtoupper(hash('sha256', implode(":", $arHash)));
?>
Answer the question
In order to leave comments, you need to log in
https://repl.it/BQA4/1
require 'digest/sha2'
@arHash = [
'm_shop',
'm_orderid',
'm_amount',
'm_curr',
'm_desc',
'm_key'
];
puts Digest::SHA256.hexdigest(@arHash.join(':')).upcase
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question