Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Add Crypto.sha512 #2287

Merged
merged 1 commit into from
Mar 27, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions doc/default/crypto.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,6 @@ Faker::Crypto.md5 #=> "6b5ed240042e8a65c55ddb826c3408e6"
Faker::Crypto.sha1 #=> "4e99e31c51eef8b2d290e709f757f92e558a503f"

Faker::Crypto.sha256 #=> "51e4dbb424cd9db1ec5fb989514f2a35652ececef33f21c8dd1fd61bb8e3929d"

Faker::Crypto.sha512 #=> "7b9fc82a6642874833d01b74a7b4fae3d15373193b55cfba47327f8f0afdc8d0ea155b58639a03a887009ef997dab8dd8d36767620d430f6e787e5996e26da80"
```
13 changes: 13 additions & 0 deletions lib/faker/default/crypto.rb
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,19 @@ def sha1
def sha256
OpenSSL::Digest::SHA256.hexdigest(Lorem.characters)
end

##
# Produces a SHA512 hash.
#
# @return [String]
#
# @example
# Faker::Crypto.sha512 #=> "7b9fc82a6642874833d01b74a7b4fae3d15373193b55cfba47327f8f0afdc8d0ea155b58639a03a887009ef997dab8dd8d36767620d430f6e787e5996e26da80"
#
# @faker.version next
def sha512
OpenSSL::Digest::SHA512.hexdigest(Lorem.characters)
end
end
end
end