digest 3.0.0 → 3.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ca0a4032ec35dc7d0948a072263772ccb40fec3d5244a693bdca359641d88a53
4
- data.tar.gz: 5ac7e173aabf71b6154168c34b3d630ca531a10233451f5ab9e7d9112cf5d889
3
+ metadata.gz: 7207f387ca787774225cd9df57fae5c62761095cbe5976d3b0e92844ce700add
4
+ data.tar.gz: 7c5bdbbac47aa05a44bc9bc37a4519a4eb7c062dfc781dd8b4c6b567a6596aa1
5
5
  SHA512:
6
- metadata.gz: 64ff7f9e99ae227bc21477c909485128d4a45ab6a183a8984fb227de8f83d3380b9e80f695f3d59614d0a7f0bc7dff4226ba68ac9905d4631f79e34e68c6fe88
7
- data.tar.gz: ff8b0a0e1193e9507f7c53757e005fbe1de229c2c09cdcb54299afef88e050057a66cd597e3c3e1ad7c17967a07d33a7b1ad14fd9245ef9d51d3db9286589d42
6
+ metadata.gz: b589e6eb9462f1e9572ba5186840437f85bf6c5c7a12665ef3b6b6d0848a2e372f1df9b228a49b6e5321ca280353cf5de652ad5404af5cc200c4fe301ce37760
7
+ data.tar.gz: 40f9583406b3f58ff6f22c8af4a2a414db6753b472201d22471eca5df1c16ca5563ca56700357a3165250505697a9fa58e6f73da7c0baf8ea56a5e12589aff3e
@@ -1,6 +1,4 @@
1
1
  # frozen_string_literal: false
2
2
  require 'mkmf'
3
3
 
4
- $defs << "-DHAVE_CONFIG_H"
5
-
6
4
  create_makefile('digest/bubblebabble')
@@ -6,6 +6,6 @@ require "mkmf"
6
6
 
7
7
  $INSTALLFILES = {
8
8
  "digest.h" => "$(HDRDIR)"
9
- }
9
+ } if $extmk
10
10
 
11
11
  create_makefile("digest")
@@ -0,0 +1,3 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'digest.so'
@@ -0,0 +1,3 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'digest/sha2.so'
@@ -6,8 +6,6 @@
6
6
  require "mkmf"
7
7
  require File.expand_path("../../digest_conf", __FILE__)
8
8
 
9
- $defs << "-DHAVE_CONFIG_H"
10
-
11
9
  $objs = [ "md5init.#{$OBJEXT}" ]
12
10
 
13
11
  digest_conf("md5")
data/ext/digest/md5/md5.c CHANGED
@@ -225,7 +225,7 @@ md5_process(MD5_CTX *pms, const uint8_t *data /*[64]*/)
225
225
  uint32_t xbuf[16];
226
226
  const uint32_t *X;
227
227
 
228
- if (!((data - (const uint8_t *)0) & 3)) {
228
+ if (!(((uintptr_t)data) & 3)) {
229
229
  /* data are properly aligned */
230
230
  X = (const uint32_t *)data;
231
231
  } else {
@@ -6,7 +6,9 @@
6
6
  require "mkmf"
7
7
  require File.expand_path("../../digest_conf", __FILE__)
8
8
 
9
- $defs << "-DNDEBUG" << "-DHAVE_CONFIG_H"
9
+ if try_static_assert("RUBY_API_VERSION_MAJOR < 3", "ruby/version.h")
10
+ $defs << "-DNDEBUG"
11
+ end
10
12
 
11
13
  $objs = [ "rmd160init.#{$OBJEXT}" ]
12
14
 
@@ -6,8 +6,6 @@
6
6
  require "mkmf"
7
7
  require File.expand_path("../../digest_conf", __FILE__)
8
8
 
9
- $defs << "-DHAVE_CONFIG_H"
10
-
11
9
  $objs = [ "sha1init.#{$OBJEXT}" ]
12
10
 
13
11
  digest_conf("sha1")
@@ -6,8 +6,6 @@
6
6
  require "mkmf"
7
7
  require File.expand_path("../../digest_conf", __FILE__)
8
8
 
9
- $defs << "-DHAVE_CONFIG_H"
10
-
11
9
  $objs = [ "sha2init.#{$OBJEXT}" ]
12
10
 
13
11
  unless digest_conf("sha2")
@@ -94,7 +94,7 @@
94
94
 
95
95
  /*
96
96
  * Define the followingsha2_* types to types of the correct length on
97
- * the native archtecture. Most BSD systems and Linux define u_intXX_t
97
+ * the native architecture. Most BSD systems and Linux define u_intXX_t
98
98
  * types. Machines with very recent ANSI C headers, can use the
99
99
  * uintXX_t definintions from inttypes.h by defining SHA2_USE_INTTYPES_H
100
100
  * during compile or in the sha.h header file.
@@ -575,7 +575,7 @@ void SHA256_Update(SHA256_CTX* context, const sha2_byte *data, size_t len) {
575
575
  usedspace = freespace = 0;
576
576
  }
577
577
 
578
- int SHA256_Final(sha2_byte digest[], SHA256_CTX* context) {
578
+ int SHA256_Final(sha2_byte digest[SHA256_DIGEST_LENGTH], SHA256_CTX* context) {
579
579
  sha2_word32 *d = (sha2_word32*)digest;
580
580
  unsigned int usedspace;
581
581
 
@@ -640,7 +640,7 @@ int SHA256_Final(sha2_byte digest[], SHA256_CTX* context) {
640
640
  return 1;
641
641
  }
642
642
 
643
- char *SHA256_End(SHA256_CTX* context, char buffer[]) {
643
+ char *SHA256_End(SHA256_CTX* context, char buffer[SHA256_DIGEST_STRING_LENGTH]) {
644
644
  sha2_byte digest[SHA256_DIGEST_LENGTH], *d = digest;
645
645
  int i;
646
646
 
@@ -943,7 +943,7 @@ void SHA512_Last(SHA512_CTX* context) {
943
943
  SHA512_Transform(context, (sha2_word64*)context->buffer);
944
944
  }
945
945
 
946
- int SHA512_Final(sha2_byte digest[], SHA512_CTX* context) {
946
+ int SHA512_Final(sha2_byte digest[SHA512_DIGEST_LENGTH], SHA512_CTX* context) {
947
947
  sha2_word64 *d = (sha2_word64*)digest;
948
948
 
949
949
  /* Sanity check: */
@@ -973,7 +973,7 @@ int SHA512_Final(sha2_byte digest[], SHA512_CTX* context) {
973
973
  return 1;
974
974
  }
975
975
 
976
- char *SHA512_End(SHA512_CTX* context, char buffer[]) {
976
+ char *SHA512_End(SHA512_CTX* context, char buffer[SHA512_DIGEST_STRING_LENGTH]) {
977
977
  sha2_byte digest[SHA512_DIGEST_LENGTH], *d = digest;
978
978
  int i;
979
979
 
@@ -1019,7 +1019,7 @@ void SHA384_Update(SHA384_CTX* context, const sha2_byte* data, size_t len) {
1019
1019
  SHA512_Update((SHA512_CTX*)context, data, len);
1020
1020
  }
1021
1021
 
1022
- int SHA384_Final(sha2_byte digest[], SHA384_CTX* context) {
1022
+ int SHA384_Final(sha2_byte digest[SHA384_DIGEST_LENGTH], SHA384_CTX* context) {
1023
1023
  sha2_word64 *d = (sha2_word64*)digest;
1024
1024
 
1025
1025
  /* Sanity check: */
@@ -1049,7 +1049,7 @@ int SHA384_Final(sha2_byte digest[], SHA384_CTX* context) {
1049
1049
  return 1;
1050
1050
  }
1051
1051
 
1052
- char *SHA384_End(SHA384_CTX* context, char buffer[]) {
1052
+ char *SHA384_End(SHA384_CTX* context, char buffer[SHA384_DIGEST_STRING_LENGTH]) {
1053
1053
  sha2_byte digest[SHA384_DIGEST_LENGTH], *d = digest;
1054
1054
  int i;
1055
1055
 
@@ -11,7 +11,7 @@
11
11
  # $Id$
12
12
 
13
13
  require 'digest'
14
- require 'digest/sha2.so'
14
+ require 'digest/sha2/loader'
15
15
 
16
16
  module Digest
17
17
  #
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Digest
4
+ VERSION = "3.1.0"
5
+ end
data/lib/digest.rb CHANGED
@@ -1,5 +1,19 @@
1
1
  # frozen_string_literal: false
2
- require 'digest.so'
2
+
3
+ if defined?(Digest) &&
4
+ /\A(?:2\.|3\.0\.[0-2]\z)/.match?(RUBY_VERSION) &&
5
+ caller_locations.any? { |l|
6
+ %r{/(rubygems/gem_runner|bundler/cli)\.rb}.match?(l.path)
7
+ }
8
+ # Before Ruby 3.0.3/3.1.0, the gem and bundle commands used to load
9
+ # the digest library before loading additionally installed gems, so
10
+ # you will get constant redefinition warnings and unexpected
11
+ # implementation overwriting if we proceed here. Avoid that.
12
+ return
13
+ end
14
+
15
+ require 'digest/version'
16
+ require 'digest/loader'
3
17
 
4
18
  module Digest
5
19
  # A mutex for Digest().
@@ -8,7 +22,7 @@ module Digest
8
22
  def self.const_missing(name) # :nodoc:
9
23
  case name
10
24
  when :SHA256, :SHA384, :SHA512
11
- lib = 'digest/sha2.so'
25
+ lib = 'digest/sha2'
12
26
  else
13
27
  lib = File.join('digest', name.to_s.downcase)
14
28
  end
metadata CHANGED
@@ -1,77 +1,30 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: digest
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.0
4
+ version: 3.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Akinori MUSHA
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-12-18 00:00:00.000000000 Z
12
- dependencies:
13
- - !ruby/object:Gem::Dependency
14
- name: bundler
15
- requirement: !ruby/object:Gem::Requirement
16
- requirements:
17
- - - ">="
18
- - !ruby/object:Gem::Version
19
- version: '0'
20
- type: :development
21
- prerelease: false
22
- version_requirements: !ruby/object:Gem::Requirement
23
- requirements:
24
- - - ">="
25
- - !ruby/object:Gem::Version
26
- version: '0'
27
- - !ruby/object:Gem::Dependency
28
- name: rake
29
- requirement: !ruby/object:Gem::Requirement
30
- requirements:
31
- - - ">="
32
- - !ruby/object:Gem::Version
33
- version: '0'
34
- type: :development
35
- prerelease: false
36
- version_requirements: !ruby/object:Gem::Requirement
37
- requirements:
38
- - - ">="
39
- - !ruby/object:Gem::Version
40
- version: '0'
41
- - !ruby/object:Gem::Dependency
42
- name: rake-compiler
43
- requirement: !ruby/object:Gem::Requirement
44
- requirements:
45
- - - ">="
46
- - !ruby/object:Gem::Version
47
- version: '0'
48
- type: :development
49
- prerelease: false
50
- version_requirements: !ruby/object:Gem::Requirement
51
- requirements:
52
- - - ">="
53
- - !ruby/object:Gem::Version
54
- version: '0'
11
+ date: 2021-12-24 00:00:00.000000000 Z
12
+ dependencies: []
55
13
  description: Provides a framework for message digest libraries.
56
14
  email:
57
15
  - knu@idaemons.org
58
16
  executables: []
59
17
  extensions:
60
- - ext/digest/extconf.rb
61
18
  - ext/digest/bubblebabble/extconf.rb
19
+ - ext/digest/extconf.rb
62
20
  - ext/digest/md5/extconf.rb
63
21
  - ext/digest/rmd160/extconf.rb
64
22
  - ext/digest/sha1/extconf.rb
65
23
  - ext/digest/sha2/extconf.rb
66
24
  extra_rdoc_files: []
67
25
  files:
68
- - Gemfile
69
26
  - LICENSE.txt
70
27
  - README.md
71
- - Rakefile
72
- - bin/console
73
- - bin/setup
74
- - digest.gemspec
75
28
  - ext/digest/bubblebabble/bubblebabble.c
76
29
  - ext/digest/bubblebabble/extconf.rb
77
30
  - ext/digest/defs.h
@@ -79,6 +32,8 @@ files:
79
32
  - ext/digest/digest.h
80
33
  - ext/digest/digest_conf.rb
81
34
  - ext/digest/extconf.rb
35
+ - ext/digest/lib/digest/loader.rb
36
+ - ext/digest/lib/digest/sha2/loader.rb
82
37
  - ext/digest/md5/extconf.rb
83
38
  - ext/digest/md5/md5.c
84
39
  - ext/digest/md5/md5.h
@@ -94,21 +49,21 @@ files:
94
49
  - ext/digest/sha1/sha1cc.h
95
50
  - ext/digest/sha1/sha1init.c
96
51
  - ext/digest/sha2/extconf.rb
97
- - ext/digest/sha2/lib/sha2.rb
98
52
  - ext/digest/sha2/sha2.c
99
53
  - ext/digest/sha2/sha2.h
100
54
  - ext/digest/sha2/sha2cc.h
101
55
  - ext/digest/sha2/sha2init.c
102
56
  - ext/digest/test.sh
103
- - ext/openssl/deprecation.rb
104
57
  - lib/digest.rb
58
+ - lib/digest/sha2.rb
59
+ - lib/digest/version.rb
105
60
  homepage: https://github.com/ruby/digest
106
61
  licenses:
107
62
  - Ruby
108
63
  - BSD-2-Clause
109
64
  metadata:
110
65
  msys2_mingw_dependencies: openssl
111
- post_install_message:
66
+ post_install_message:
112
67
  rdoc_options: []
113
68
  require_paths:
114
69
  - lib
@@ -116,15 +71,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
116
71
  requirements:
117
72
  - - ">="
118
73
  - !ruby/object:Gem::Version
119
- version: 2.3.0
74
+ version: 2.5.0
120
75
  required_rubygems_version: !ruby/object:Gem::Requirement
121
76
  requirements:
122
77
  - - ">="
123
78
  - !ruby/object:Gem::Version
124
79
  version: '0'
125
80
  requirements: []
126
- rubygems_version: 3.2.2
127
- signing_key:
81
+ rubygems_version: 3.2.32
82
+ signing_key:
128
83
  specification_version: 4
129
84
  summary: Provides a framework for message digest libraries.
130
85
  test_files: []
data/Gemfile DELETED
@@ -1,6 +0,0 @@
1
- source "https://rubygems.org"
2
-
3
- git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
4
-
5
- # Specify your gem's dependencies in digest.gemspec
6
- gemspec
data/Rakefile DELETED
@@ -1,15 +0,0 @@
1
- require "bundler/gem_tasks"
2
- require "rake/testtask"
3
-
4
- Rake::TestTask.new(:test) do |t|
5
- ENV["RUBYOPT"] = "-Itest -Itest/lib -Ilib"
6
- t.test_files = FileList["test/**/test_*.rb"]
7
- end
8
-
9
- require 'rake/extensiontask'
10
- Rake::ExtensionTask.new("digest")
11
- %w(bubblebabble md5 rmd160 sha1 sha2).each do |ext|
12
- Rake::ExtensionTask.new("digest/#{ext}")
13
- end
14
-
15
- task :default => :test
data/bin/console DELETED
@@ -1,14 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- require "bundler/setup"
4
- require "digest"
5
-
6
- # You can add fixtures and/or initialization code here to make experimenting
7
- # with your gem easier. You can also use a different console, if you like.
8
-
9
- # (If you use this, don't forget to add pry to your Gemfile!)
10
- # require "pry"
11
- # Pry.start
12
-
13
- require "irb"
14
- IRB.start(__FILE__)
data/bin/setup DELETED
@@ -1,8 +0,0 @@
1
- #!/usr/bin/env bash
2
- set -euo pipefail
3
- IFS=$'\n\t'
4
- set -vx
5
-
6
- bundle install
7
-
8
- # Do any other automated setup that you need to do here
data/digest.gemspec DELETED
@@ -1,47 +0,0 @@
1
- # coding: utf-8
2
- # frozen_string_literal: true
3
-
4
- Gem::Specification.new do |spec|
5
- spec.name = "digest"
6
- spec.version = "3.0.0"
7
- spec.authors = ["Akinori MUSHA"]
8
- spec.email = ["knu@idaemons.org"]
9
-
10
- spec.summary = %q{Provides a framework for message digest libraries.}
11
- spec.description = %q{Provides a framework for message digest libraries.}
12
- spec.homepage = "https://github.com/ruby/digest"
13
- spec.licenses = ["Ruby", "BSD-2-Clause"]
14
-
15
- spec.files = [
16
- "Gemfile", "LICENSE.txt", "README.md", "Rakefile", "bin/console", "bin/setup", "digest.gemspec",
17
- "ext/digest/bubblebabble/bubblebabble.c", "ext/digest/bubblebabble/extconf.rb", "ext/digest/defs.h",
18
- "ext/digest/digest.c", "ext/digest/digest.h", "ext/digest/digest_conf.rb", "ext/digest/extconf.rb",
19
- "ext/digest/md5/extconf.rb", "ext/digest/md5/md5.c", "ext/digest/md5/md5.h", "ext/digest/md5/md5cc.h",
20
- "ext/digest/md5/md5init.c", "ext/digest/rmd160/extconf.rb", "ext/digest/rmd160/rmd160.c",
21
- "ext/digest/rmd160/rmd160.h", "ext/digest/rmd160/rmd160init.c", "ext/digest/sha1/extconf.rb",
22
- "ext/digest/sha1/sha1.c", "ext/digest/sha1/sha1.h", "ext/digest/sha1/sha1cc.h",
23
- "ext/digest/sha1/sha1init.c", "ext/digest/sha2/extconf.rb", "ext/digest/sha2/lib/sha2.rb",
24
- "ext/digest/sha2/sha2.c", "ext/digest/sha2/sha2.h", "ext/digest/sha2/sha2cc.h",
25
- "ext/digest/sha2/sha2init.c", "ext/digest/test.sh", "ext/openssl/deprecation.rb",
26
- "lib/digest.rb"
27
- ]
28
-
29
- spec.required_ruby_version = ">= 2.3.0"
30
-
31
- spec.bindir = "exe"
32
- spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
33
- spec.require_paths = ["lib"]
34
- spec.extensions = %w[
35
- ext/digest/extconf.rb
36
- ext/digest/bubblebabble/extconf.rb
37
- ext/digest/md5/extconf.rb
38
- ext/digest/rmd160/extconf.rb
39
- ext/digest/sha1/extconf.rb
40
- ext/digest/sha2/extconf.rb
41
- ]
42
- spec.metadata["msys2_mingw_dependencies"] = "openssl"
43
-
44
- spec.add_development_dependency "bundler"
45
- spec.add_development_dependency "rake"
46
- spec.add_development_dependency "rake-compiler"
47
- end
@@ -1,23 +0,0 @@
1
- # frozen_string_literal: false
2
- module OpenSSL
3
- def self.deprecated_warning_flag
4
- unless flag = (@deprecated_warning_flag ||= nil)
5
- if try_compile("", flag = "-Werror=deprecated-declarations")
6
- $warnflags << " #{flag}"
7
- else
8
- flag = ""
9
- end
10
- @deprecated_warning_flag = flag
11
- end
12
- flag
13
- end
14
-
15
- def self.check_func(func, header)
16
- have_func(func, header, deprecated_warning_flag)
17
- end
18
-
19
- def self.check_func_or_macro(func, header)
20
- check_func(func, header) or
21
- have_macro(func, header) && $defs.push("-DHAVE_#{func.upcase}")
22
- end
23
- end