-1

I want equivalent of hashlib.sha256("Development").hexdigest() of python in ruby script

Kindly suggest as soon as possible.

I am using it for aws cloudfront.
Kindly suggest some ruby scripts for cloudfront invalidation on 2014-10-21.

Kunaparaju
  • 13
  • 4

1 Answers1

0

Check out Digest and its subclasses:

require 'digest'
Digest::SHA256.hexdigest('Development')
=> "21b6a798321a49f75b9c3827fa3cfdb7efe2c4e05c3d13aefe1c825b9774a158"
zwippie
  • 15,050
  • 3
  • 39
  • 54
  • How to use hashlib in ruby? I am using sign-4 for 2014-10-21 for invalidation. Can u suggest some examples for 2014-10-21 cloudfront invalidation – Kunaparaju Nov 06 '14 at 13:38
  • Sorry but I am not familiar with Cloudfront. BTW, what does that date has to do with it? – zwippie Nov 06 '14 at 13:59
  • It is version of cloudfront api. we have to send request to "2014-10-21/distribution/distribution ID/invalidation resource" to invalidate our distribution. http://docs.aws.amazon.com/AmazonCloudFront/latest/APIReference/CreateInvalidation.html – Kunaparaju Nov 06 '14 at 14:02
  • The problem is with Signature Version 4 Authentication. I was getting 403 response from http. – Kunaparaju Nov 06 '14 at 14:07