1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

PStore: select checksum algorithm

* lib/pstore.rb (PStore::CHECKSUM_ALGO): find available hashing
  algorithm for checksum.  MD5 is not available in FIPS mode.
  [Feature #6943]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56284 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2016-09-28 14:14:21 +00:00
parent d90b767d2b
commit 9f9add3eb5
2 changed files with 13 additions and 2 deletions

View file

@ -1,3 +1,9 @@
Wed Sep 28 23:14:19 2016 Nobuyoshi Nakada <nobu@ruby-lang.org>
* lib/pstore.rb (PStore::CHECKSUM_ALGO): find available hashing
algorithm for checksum. MD5 is not available in FIPS mode.
[Feature #6943]
Wed Sep 28 13:00:25 2016 ksss <co000ri@gmail.com>
* signal.c (sig_signame): [DOC] Add documentation in the case of

View file

@ -8,7 +8,7 @@
#
# See PStore for documentation.
require "digest/md5"
require "digest"
#
# PStore implements a file based persistence mechanism based on a Hash. User
@ -352,7 +352,12 @@ class PStore
private
# Constant for relieving Ruby's garbage collector.
CHECKSUM_ALGO = Digest::MD5
CHECKSUM_ALGO = %w[SHA512 SHA384 SHA256 SHA1 RMD160 MD5].each do |algo|
begin
break Digest(algo)
rescue LoadError
end
end
EMPTY_STRING = ""
EMPTY_MARSHAL_DATA = Marshal.dump({})
EMPTY_MARSHAL_CHECKSUM = CHECKSUM_ALGO.digest(EMPTY_MARSHAL_DATA)