aead 1.7.0 → 1.7.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.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/VERSION +1 -1
  3. data/lib/aead/cipher.rb +16 -10
  4. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8825adccc98fe839879e58bedc415be621cd775a
4
- data.tar.gz: 622af7623697b2454e9711407c86d352af0e409a
3
+ metadata.gz: f2f9d893d13bf1ab608c431512db1f6baa41aae0
4
+ data.tar.gz: a84951a5bf9c63535c3edc0255ed16ff102548f9
5
5
  SHA512:
6
- metadata.gz: 8f9a653595badcf279d04238d6d7b43f5f32a34ac811af02b740f710d09c4defd5c6c0c5499021fa6b0889b36e02f1235a087853b87a90387b507a8fb3acb2bf
7
- data.tar.gz: 0fd5e4e7109e3f49a1b58b7e30cb23c961f582053318fd9c9cacb52f0ee59da987d0794d4e0e8672f1cc4f428ca7ec1dfd91511cb9293b519e7094a6a180f2c0
6
+ metadata.gz: cf6c61ea01d7844ead4ea6e37e50c035ffc94531d44eb903bd65d1e747c5f077bd9f5193a4eca95702d778af48bbeced41dc638ce0a126c66e018b28f0259917
7
+ data.tar.gz: 7fe370188d0280ea619c1ab0c295185f33b0f2920b0c09ac969cac4c506305be32a0a37c48edaf76527fbc724451507460732b1df4283b7b64f328e4d685b6b2
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.7.0
1
+ 1.7.1
@@ -109,11 +109,14 @@ class AEAD::Cipher
109
109
  # @return [String] the generated AEAD
110
110
  #
111
111
  def encrypt(nonce, aad, plaintext)
112
- if nonce.respond_to?(:force_encoding)
113
- nonce .force_encoding('ASCII-8BIT')
114
- aad .force_encoding('ASCII-8BIT')
115
- plaintext.force_encoding('ASCII-8BIT')
116
- end
112
+ nonce.force_encoding('ASCII-8BIT') if
113
+ nonce.respond_to?(:force_encoding)
114
+
115
+ aad.force_encoding('ASCII-8BIT') if
116
+ aad.respond_to?(:force_encoding)
117
+
118
+ plaintext.force_encoding('ASCII-8BIT') if
119
+ plaintext.respond_to?(:force_encoding)
117
120
 
118
121
  _verify_nonce_bytesize(nonce, self.nonce_len)
119
122
  _verify_plaintext_presence(plaintext)
@@ -135,11 +138,14 @@ class AEAD::Cipher
135
138
  # @return [String] the original plaintext
136
139
  #
137
140
  def decrypt(nonce, aad, aead)
138
- if nonce.respond_to?(:force_encoding)
139
- nonce.force_encoding('ASCII-8BIT')
140
- aad .force_encoding('ASCII-8BIT')
141
- aead .force_encoding('ASCII-8BIT')
142
- end
141
+ nonce.force_encoding('ASCII-8BIT') if
142
+ nonce.respond_to?(:force_encoding)
143
+
144
+ aad.force_encoding('ASCII-8BIT') if
145
+ aad.respond_to?(:force_encoding)
146
+
147
+ aead.force_encoding('ASCII-8BIT') if
148
+ aead.respond_to?(:force_encoding)
143
149
 
144
150
  _verify_nonce_bytesize(nonce, self.nonce_len)
145
151
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: aead
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.7.0
4
+ version: 1.7.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stephen Touset