gmssl 1.1.0 → 1.1.1

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: 91be02f2afeab55a32d5baa453111c80def28f5d1abfbf6be95b137f216103dd
4
- data.tar.gz: 8b6c27ee63aac9a32249f6050fe146211f14ba0cb50c021791e4b6886a011a79
3
+ metadata.gz: f7e663d96e76c2db23bf58d1a32af5dee12caa50388867dbb72edda107bd0a65
4
+ data.tar.gz: 83d4a5d271287c85bada897a9fd22a4ee5db8e4d96cf9dac6fe59f9c58492eb8
5
5
  SHA512:
6
- metadata.gz: 00c9c994e7a478215afa4705a4ac03d8b08e5e651d4cc8b1ddd1a7a9b6224fe62e2c3804ae4dca950c6b4ddc44a7b68d75fcce8f7098a99782ff9cf73ae22095
7
- data.tar.gz: 42770e67af88dcde97433e3a70064bcef5dececf5700ff232752385f41cca461adc3b781ee7548aa0346aaf1d88a6edc84296fa19857b0c1223d3ce381aa8056
6
+ metadata.gz: a2d9c2376e77251cd14214f75bc11770b4c3711e7cac6fccc88ac65b44d297d95424b9681b860bd9a6332f66e64605f3e4ccaf27472933d1bb4d82f34677a9f6
7
+ data.tar.gz: ea7f7305374bb138ec02ca4ebb85cb1fa948fb1aaedd12790f85d145e30ced25b981d7512709fa03d11509f5da68199fd7a9c207d966b62d0ff637c317f170c9
@@ -0,0 +1,19 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Helper
4
+ # Example usage
5
+ # hex_string = "54A38E3B599E48C4F581FEC14B62EA29"
6
+ # packed_bytes = hex_string_to_packed_bytes(hex_string)
7
+ # puts packed_bytes
8
+ def hex_string_to_packed_bytes(hex_string)
9
+ hex_string.scan(/../).map { |byte| byte.hex }.pack("C*")
10
+ end
11
+
12
+ # Example usage
13
+ # bytes = [0x54, 0xA3, 0x8E, 0x3B, 0x59, 0x9E, 0x48, 0xC4]
14
+ # hex_string = bytes_to_hex_string(bytes.pack('C*'))
15
+ # puts hex_string
16
+ def bytes_to_hex_string(bytes)
17
+ bytes.unpack1('H*')
18
+ end
19
+ end
data/lib/gmssl/sm3.rb CHANGED
@@ -1,10 +1,11 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'ffi'
4
- require 'helper'
4
+ require 'gmssl/helper'
5
5
 
6
6
  module GmSSL
7
7
  module SM3
8
+ extend Helper
8
9
  extend FFI::Library
9
10
  file = File.join GmSSL.lib, LIB_FILE
10
11
  ffi_lib file
data/lib/gmssl/sm4.rb CHANGED
@@ -1,11 +1,12 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'ffi'
4
-
5
4
  require 'gmssl/ghash'
5
+ require 'gmssl/helper'
6
6
 
7
7
  module GmSSL
8
8
  module SM4
9
+ extend Helper
9
10
  extend FFI::Library
10
11
  file = File.join GmSSL.lib, LIB_FILE
11
12
  ffi_lib file
data/lib/gmssl/zuc.rb CHANGED
@@ -1,10 +1,11 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'ffi'
4
- require 'helper'
4
+ require 'gmssl/helper'
5
5
 
6
6
  module GmSSL
7
7
  module ZUC
8
+ extend Helper
8
9
  extend FFI::Library
9
10
  file = File.join GmSSL.lib, LIB_FILE
10
11
  ffi_lib file
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gmssl
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - memorycancel
8
8
  bindir: bin
9
9
  cert_chain: []
10
- date: 2025-01-22 00:00:00.000000000 Z
10
+ date: 2025-01-23 00:00:00.000000000 Z
11
11
  dependencies: []
12
12
  description: GmSSL c to ruby FFI
13
13
  email: memorycancel@gmail.com
@@ -68,6 +68,7 @@ files:
68
68
  - GmSSL/build/bin/zuctest
69
69
  - lib/gmssl.rb
70
70
  - lib/gmssl/ghash.rb
71
+ - lib/gmssl/helper.rb
71
72
  - lib/gmssl/random.rb
72
73
  - lib/gmssl/sm3.rb
73
74
  - lib/gmssl/sm4.rb