Home > Software design >  Rails - calculate with the use of sha384
Rails - calculate with the use of sha384

Time:02-10

I need to make something like this:

Checksum of parameters: {"sessionId":"str","merchantId":int,"amount":int,"currency":"str","crc":"str"}

calculated with the use of sha384

My code:

   sha3 = Digest::SHA384.hexdigest(

      session_.to_s   @config['seller_id'].to_s   @account['amount'].to_s   
      currency.to_s   APP_CONFIG['payment']['pin'].to_s
    
    )
      
    sha3_ = sha3

Where:

session_ = 9c64637ebfa5ef0b3ed42a64d2ebfce7

@config['seller_id'] = 12345

@account['amount'] = 2000

currency = 'PLN'

APP_CONFIG['payment']['pin'] = 1234567890

Doing it wrong or right? Payment company said that my sha3_ is wrong.

CodePudding user response:

I bet you need to calculate JSON checksum.

  • Related