rbnacl 5.0.0 → 6.0.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.
Files changed (55) hide show
  1. checksums.yaml +5 -5
  2. data/.gitignore +1 -0
  3. data/.rubocop.yml +34 -12
  4. data/.travis.yml +16 -16
  5. data/CHANGES.md +37 -10
  6. data/Gemfile +4 -3
  7. data/Guardfile +2 -0
  8. data/LICENSE.txt +1 -1
  9. data/README.md +31 -21
  10. data/Rakefile +4 -3
  11. data/lib/rbnacl.rb +8 -3
  12. data/lib/rbnacl/aead/base.rb +3 -0
  13. data/lib/rbnacl/aead/chacha20poly1305_ietf.rb +2 -2
  14. data/lib/rbnacl/aead/chacha20poly1305_legacy.rb +2 -2
  15. data/lib/rbnacl/aead/xchacha20poly1305_ietf.rb +44 -0
  16. data/lib/rbnacl/boxes/curve25519xsalsa20poly1305.rb +6 -5
  17. data/lib/rbnacl/boxes/curve25519xsalsa20poly1305/private_key.rb +1 -1
  18. data/lib/rbnacl/group_elements/curve25519.rb +2 -1
  19. data/lib/rbnacl/hash/blake2b.rb +6 -4
  20. data/lib/rbnacl/hash/sha256.rb +1 -1
  21. data/lib/rbnacl/hash/sha512.rb +1 -1
  22. data/lib/rbnacl/hmac/sha256.rb +73 -8
  23. data/lib/rbnacl/hmac/sha512.rb +73 -8
  24. data/lib/rbnacl/hmac/sha512256.rb +71 -8
  25. data/lib/rbnacl/init.rb +1 -5
  26. data/lib/rbnacl/one_time_auths/poly1305.rb +2 -2
  27. data/lib/rbnacl/password_hash.rb +33 -2
  28. data/lib/rbnacl/password_hash/argon2.rb +37 -18
  29. data/lib/rbnacl/password_hash/scrypt.rb +1 -1
  30. data/lib/rbnacl/random.rb +1 -3
  31. data/lib/rbnacl/secret_boxes/xsalsa20poly1305.rb +2 -2
  32. data/lib/rbnacl/signatures/ed25519/signing_key.rb +2 -2
  33. data/lib/rbnacl/signatures/ed25519/verify_key.rb +1 -1
  34. data/lib/rbnacl/sodium.rb +16 -12
  35. data/lib/rbnacl/sodium/version.rb +3 -1
  36. data/lib/rbnacl/test_vectors.rb +104 -44
  37. data/lib/rbnacl/util.rb +92 -8
  38. data/lib/rbnacl/version.rb +1 -1
  39. data/rbnacl.gemspec +6 -7
  40. data/spec/rbnacl/aead/xchacha20poly1305_ietf_spec.rb +14 -0
  41. data/spec/rbnacl/authenticators/poly1305_spec.rb +21 -1
  42. data/spec/rbnacl/boxes/curve25519xsalsa20poly1305_spec.rb +18 -6
  43. data/spec/rbnacl/hmac/sha256_spec.rb +6 -1
  44. data/spec/rbnacl/hmac/sha512256_spec.rb +6 -1
  45. data/spec/rbnacl/hmac/sha512_spec.rb +6 -1
  46. data/spec/rbnacl/password_hash/argon2_spec.rb +56 -14
  47. data/spec/rbnacl/signatures/ed25519/signing_key_spec.rb +5 -4
  48. data/spec/rbnacl/util_spec.rb +63 -4
  49. data/spec/shared/aead.rb +33 -13
  50. data/spec/shared/authenticator.rb +0 -19
  51. data/spec/shared/box.rb +18 -6
  52. data/spec/shared/hmac.rb +46 -0
  53. data/spec/spec_helper.rb +3 -1
  54. metadata +22 -18
  55. data/.ruby-version +0 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 0ff080260ca84ccc368c7c8414627267dffa9348
4
- data.tar.gz: 2a3275a27b2ca89e36223529316076b67f895cac
2
+ SHA256:
3
+ metadata.gz: 00e82b69d0f03bb3d5e4dbe1dbcef2b70aabcbe33630a1c68b9d713a64f52c58
4
+ data.tar.gz: bdeb5770fd8d698b66ff967b0674c5a06b8e4bc77f24507128a0460dda7be97c
5
5
  SHA512:
6
- metadata.gz: 32bd4e83ea75ce57d93dcc7c1b2f3249d7e0010694c03d7d9a73a20e1a310ec6b9b6f40e0f190fb454f64eda528ea4e7eb35367d49d04f5ea7aafad270d26ff2
7
- data.tar.gz: 9408f5ae9713e018e29a943bb9ddbb64010e9ace49d4cff37b2769e886f09025edba7776dcfbe81372363051b8d7b68cd7e04a583b8eeda87b3d48a17f39607b
6
+ metadata.gz: a4d5e5c9f0d4a0cf0e264b4f0cc49e071131fd5a158bd732a2e5fb8134a480c63d5fa8f384b853b8ad2010cc5ffad99beb108bf553ae8aaa5ab15f06a96a0ee7
7
+ data.tar.gz: 5b583ce0415a169b899bac5dcf3210c2ef8b2383bf0e7f1c4a533925892fa8c83aa6dd34db10c772706b4bee0ee9576a6ab51d4326d291a5eba9177a061c9085
data/.gitignore CHANGED
@@ -17,3 +17,4 @@ test/version_tmp
17
17
  tmp
18
18
  libsodium
19
19
  libsodium-*.tar.gz
20
+ .rakeTasks
@@ -1,11 +1,8 @@
1
1
  AllCops:
2
+ TargetRubyVersion: 2.2
2
3
  DisplayCopNames: true
3
- Include:
4
- - '**/Rakefile'
5
4
  Exclude:
6
- - 'spec/**/*'
7
5
  - 'vendor/**/*'
8
- - 'lib/rbnacl/test_vectors.rb'
9
6
 
10
7
  #
11
8
  # Metrics
@@ -14,23 +11,45 @@ AllCops:
14
11
  Metrics/AbcSize:
15
12
  Max: 20
16
13
 
14
+ Metrics/BlockLength:
15
+ Max: 128
16
+ ExcludedMethods: [ 'describe' ]
17
+
17
18
  Metrics/ClassLength:
18
- Max: 150
19
+ Max: 128
20
+
21
+ Metrics/LineLength:
22
+ Max: 128
19
23
 
20
24
  Metrics/MethodLength:
21
- Max: 25
25
+ CountComments: false
26
+ Max: 50
27
+
28
+ Metrics/CyclomaticComplexity:
29
+ Max: 15
30
+
31
+ Metrics/PerceivedComplexity:
32
+ Max: 15
22
33
 
23
34
  #
24
- # Style
35
+ # Naming
25
36
  #
26
37
 
27
- LineLength:
28
- Max: 128
38
+ Naming/UncommunicativeMethodParamName:
39
+ Enabled: false
29
40
 
30
- Style/StringLiterals:
31
- EnforcedStyle: double_quotes
41
+ #
42
+ # Performance
43
+ #
32
44
 
33
- Style/SpaceBeforeFirstArg:
45
+ Performance/UnfreezeString:
46
+ Enabled: false
47
+
48
+ #
49
+ # Style
50
+ #
51
+
52
+ Style/AccessModifierDeclarations:
34
53
  Enabled: false
35
54
 
36
55
  Style/GlobalVars:
@@ -38,3 +57,6 @@ Style/GlobalVars:
38
57
 
39
58
  Style/SafeNavigation:
40
59
  Enabled: false
60
+
61
+ Style/StringLiterals:
62
+ EnforcedStyle: double_quotes
@@ -1,25 +1,25 @@
1
1
  language: ruby
2
- sudo: false
3
2
  cache: bundler
4
- script: bundle exec rake ci
5
- bundler_args: --without development
6
3
 
7
- branches:
8
- only:
9
- - master
4
+ before_install:
5
+ - sudo add-apt-repository -y ppa:chris-lea/libsodium
6
+ - sudo apt-get update -q
7
+ - sudo apt-get install libsodium-dev
8
+ - gem update --system
9
+ - gem --version
10
+ - gem install bundler -v 1.17.1
11
+ - bundle --version
10
12
 
11
13
  rvm:
12
- - jruby-9.1.6.0
13
- - 2.2.6
14
- - 2.3.3
15
- - 2.4.0
16
-
17
- env:
18
- - LIBSODIUM_VERSION=1.0.0 # Minimum supported
19
- - LIBSODIUM_VERSION=1.0.11 # Latest released
14
+ - jruby-9.1.15.0
15
+ - 2.2
16
+ - 2.3
17
+ - 2.4
18
+ - 2.5
20
19
 
21
20
  matrix:
22
21
  fast_finish: true
23
22
 
24
- notifications:
25
- irc: "irc.freenode.org#cryptosphere"
23
+ branches:
24
+ only:
25
+ - master
data/CHANGES.md CHANGED
@@ -1,52 +1,76 @@
1
+ ## [6.0.0] (2018-11-08)
2
+
3
+ [6.0.0]: https://github.com/crypto-rb/rbnacl/pull/182
4
+
5
+ * [#180](https://github.com/crypto-rb/rbnacl/pull/180)
6
+ Deprecate rbnacl-libsodium.
7
+ ([@tarcieri])
8
+
9
+ * [#176](https://github.com/crypto-rb/rbnacl/pull/176)
10
+ Add support for XChaCha20-Poly1305.
11
+ ([@AnIrishDuck])
12
+
13
+ * [#174](https://github.com/crypto-rb/rbnacl/pull/174)
14
+ Fix buffer size type in `randombytes_buf` binding.
15
+ ([@elijh])
16
+
17
+ * [#172](https://github.com/crypto-rb/rbnacl/pull/172)
18
+ Add support for argon2id digest.
19
+ ([@trofi])
20
+
21
+ * [#166](https://github.com/crypto-rb/rbnacl/pull/166)
22
+ Support for non-32-byte HMAC-SHA256/512 keys.
23
+ ([@nsheremet])
24
+
1
25
  ## 5.0.0 (2017-06-13)
2
26
 
3
- * [#159](https://github.com/cryptosphere/rbnacl/pull/159)
27
+ * [#159](https://github.com/crypto-rb/rbnacl/pull/159)
4
28
  Support the BLAKE2b Initialize-Update-Finalize API.
5
29
  ([@fudanchii])
6
30
 
7
31
  ## 4.0.2 (2017-03-12)
8
32
 
9
- * [#157](https://github.com/cryptosphere/rbnacl/pull/157)
33
+ * [#157](https://github.com/crypto-rb/rbnacl/pull/157)
10
34
  Raise error on degenerate keys (fixes #152).
11
35
  ([@paragonie-scott], [@tarcieri])
12
36
 
13
37
  ## 4.0.1 (2016-12-04)
14
38
 
15
- * [#148](https://github.com/cryptosphere/rbnacl/pull/148)
39
+ * [#148](https://github.com/crypto-rb/rbnacl/pull/148)
16
40
  Last minute changes to the ChaCha20Poly1305 API.
17
41
  ([@tarcieri])
18
42
 
19
43
  ## 4.0.0 (2016-12-04)
20
44
 
21
- * [#141](https://github.com/cryptosphere/rbnacl/pull/141)
45
+ * [#141](https://github.com/crypto-rb/rbnacl/pull/141)
22
46
  Add wrappers for ChaCha20Poly1305 AEAD ciphers.
23
47
  ([@aadavids])
24
48
 
25
- * [#142](https://github.com/cryptosphere/rbnacl/pull/142)
49
+ * [#142](https://github.com/crypto-rb/rbnacl/pull/142)
26
50
  Added support for Argon2 password hash.
27
51
  ([@elijh])
28
52
 
29
- * [#143](https://github.com/cryptosphere/rbnacl/pull/143)
53
+ * [#143](https://github.com/crypto-rb/rbnacl/pull/143)
30
54
  Require Ruby 2.2.6+.
31
55
  ([@tarcieri])
32
56
 
33
57
  ## 3.4.0 (2015-05-07)
34
58
 
35
- * [#135](https://github.com/cryptosphere/rbnacl/pull/135)
59
+ * [#135](https://github.com/crypto-rb/rbnacl/pull/135)
36
60
  Expose `RbNaCl::Signatures::Ed25519#keypair_bytes`.
37
61
  ([@grempe])
38
62
 
39
- * [#137](https://github.com/cryptosphere/rbnacl/pull/137)
63
+ * [#137](https://github.com/crypto-rb/rbnacl/pull/137)
40
64
  Expose HMAC-SHA512 (with 64-byte keys)
41
65
  ([@mwpastore])
42
66
 
43
67
  ## 3.3.0 (2015-12-29)
44
68
 
45
- * [#105](https://github.com/cryptosphere/rbnacl/pull/105)
69
+ * [#105](https://github.com/crypto-rb/rbnacl/pull/105)
46
70
  Add salt/personalisation strings for Blake2b.
47
71
  ([@namelessjon])
48
72
 
49
- * [#128](https://github.com/cryptosphere/rbnacl/pull/128)
73
+ * [#128](https://github.com/crypto-rb/rbnacl/pull/128)
50
74
  Remove use of Thread.exclusive when initializing library.
51
75
  ([@tarcieri])
52
76
 
@@ -119,3 +143,6 @@
119
143
  [@elijh]: https://github.com/elijh
120
144
  [@paragonie-scott]: https://github.com/paragonie-scott
121
145
  [@fudanchii]: https://github.com/fudanchii
146
+ [@nsheremet]: https://github.com/nsheremet
147
+ [@trofi]: https://github.com/trofi
148
+ [@AnIrishDuck]: https://github.com/AnIrishDuck
data/Gemfile CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  source "https://rubygems.org"
2
4
 
3
5
  gemspec
@@ -7,10 +9,9 @@ group :development do
7
9
  end
8
10
 
9
11
  group :test do
10
- gem "rspec"
11
- gem "rubocop", "0.46.0"
12
12
  gem "coveralls", require: false
13
- gem "rbnacl-libsodium", ENV["LIBSODIUM_VERSION"]
13
+ gem "rspec"
14
+ gem "rubocop", "= 0.60.0"
14
15
  end
15
16
 
16
17
  group :development, :test do
data/Guardfile CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # A sample Guardfile
2
4
  # More info at https://github.com/guard/guard#readme
3
5
 
@@ -1,4 +1,4 @@
1
- Copyright (c) 2012-2017 Tony Arcieri, Jonathan Stott
1
+ Copyright (c) 2012-2018 Tony Arcieri, Jonathan Stott
2
2
 
3
3
  MIT License
4
4
 
data/README.md CHANGED
@@ -1,15 +1,16 @@
1
- ![RbNaCl](https://raw.github.com/cryptosphere/rbnacl/master/images/logo.png)
1
+ ![RbNaCl](https://raw.github.com/crypto-rb/rbnacl/master/images/logo.png)
2
2
  ======
3
3
  [![Gem Version](https://badge.fury.io/rb/rbnacl.svg)](http://badge.fury.io/rb/rbnacl)
4
- [![Build Status](https://travis-ci.org/cryptosphere/rbnacl.svg?branch=master)](https://travis-ci.org/cryptosphere/rbnacl)
5
- [![Code Climate](https://codeclimate.com/github/cryptosphere/rbnacl.svg)](https://codeclimate.com/github/cryptosphere/rbnacl)
6
- [![Coverage Status](https://coveralls.io/repos/cryptosphere/rbnacl/badge.svg?branch=master)](https://coveralls.io/r/cryptosphere/rbnacl)
7
- [![MIT licensed](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/cryptosphere/rbnacl/blob/master/LICENSE.txt)
4
+ [![Build Status](https://travis-ci.org/crypto-rb/rbnacl.svg?branch=master)](https://travis-ci.org/crypto-rb/rbnacl)
5
+ [![Code Climate](https://codeclimate.com/github/crypto-rb/rbnacl.svg)](https://codeclimate.com/github/crypto-rb/rbnacl)
6
+ [![Coverage Status](https://coveralls.io/repos/crypto-rb/rbnacl/badge.svg?branch=master)](https://coveralls.io/r/crypto-rb/rbnacl)
7
+ [![MIT licensed](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/crypto-rb/rbnacl/blob/master/LICENSE.txt)
8
+ [![Gitter Chat](https://badges.gitter.im/badge.svg)](https://gitter.im/crypto-rb/Lobby)
8
9
 
9
10
  _NOTE: This is the 5.x **stable** branch of RbNaCl. For the 4.x **legacy**
10
11
  branch, please see:_
11
12
 
12
- https://github.com/cryptosphere/rbnacl/tree/4-x-stable
13
+ https://github.com/crypto-rb/rbnacl/tree/4-x-stable
13
14
 
14
15
  A Ruby binding to the state-of-the-art [Networking and Cryptography][nacl]
15
16
  library by [Daniel J. Bernstein][djb]. This is **NOT** Google Native Client.
@@ -19,7 +20,7 @@ On a completely unrelated topic, RbNaCl is also the empirical formula for
19
20
  Rubidium Sodium Chloride.
20
21
 
21
22
  Need help with RbNaCl? Join the [RbNaCl Google Group][group].
22
- We're also on IRC at #cryptosphere on irc.freenode.net
23
+ We're also on IRC at #crypto-rb on irc.freenode.net
23
24
 
24
25
  [nacl]: http://nacl.cr.yp.to/
25
26
  [djb]: http://cr.yp.to/djb.html
@@ -56,6 +57,17 @@ For more information on NaCl's goals, see Dan Bernstein's presentation
56
57
 
57
58
  [Yes.](http://news.ycombinator.com/item?id=3067434)
58
59
 
60
+ ## Help and Discussion
61
+
62
+ Have questions? Want to suggest a feature or change? Join a discussion group:
63
+
64
+ * [Crypto.rb Gitter]: web-based chat about Ruby crypto projects including **RbNaCl**.
65
+ * [Crypto.rb Google Group]: join via web or email ([crypto-rb+subscribe@googlegroups.com])
66
+
67
+ [Crypto.rb Gitter]: https://gitter.im/crypto-rb/Lobby
68
+ [Crypto.rb Google Group]: https://groups.google.com/forum/#!forum/crypto-rb
69
+ [crypto-rb+subscribe@googlegroups.com]: mailto:crypto-rb+subscribe@googlegroups.com?subject=subscribe
70
+
59
71
  ## Supported platforms
60
72
 
61
73
  You can use RbNaCl on platforms libsodium is supported (see below).
@@ -65,6 +77,7 @@ versions:
65
77
 
66
78
  * Ruby 2.2.6+
67
79
  * Ruby 2.3.0+
80
+ * Ruby 2.4.2+
68
81
  * JRuby 9.1.6.0+
69
82
 
70
83
  If something doesn't work on one of these versions, it's a bug.
@@ -80,17 +93,14 @@ patches in a timely fashion. If critical issues for a particular implementation
80
93
  exist at the time of a major release, support for that Ruby version may be
81
94
  dropped.
82
95
 
83
- [travis]: http://travis-ci.org/cryptosphere/rbnacl
96
+ [travis]: http://travis-ci.org/crypto-rb/rbnacl
84
97
 
85
98
  ## Installation
86
99
 
87
- Note: [Windows installation instructions are available](https://github.com/cryptosphere/rbnacl/wiki/Windows-Installation).
100
+ Note: [Windows installation instructions are available](https://github.com/crypto-rb/rbnacl/wiki/Windows-Installation).
88
101
 
89
102
  ### libsodium
90
103
 
91
- **NOTE: Want to avoid the hassle of installing libsodium? Use the
92
- [rbnacl-libsodium](https://github.com/cryptosphere/rbnacl-libsodium) gem**
93
-
94
104
  To use RbNaCl, you will need to install libsodium:
95
105
 
96
106
  https://github.com/jedisct1/libsodium
@@ -153,13 +163,13 @@ information.
153
163
 
154
164
  [YARD API documentation][yard] is also available.
155
165
 
156
- [wiki]: https://github.com/cryptosphere/rbnacl/wiki
157
- [simplebox]: https://github.com/cryptosphere/rbnacl/wiki/SimpleBox
158
- [secretkey]: https://github.com/cryptosphere/rbnacl/wiki/Secret-Key-Encryption
159
- [publickey]: https://github.com/cryptosphere/rbnacl/wiki/Public-Key-Encryption
160
- [signatures]: https://github.com/cryptosphere/rbnacl/wiki/Digital-Signatures
161
- [macs]: https://github.com/cryptosphere/rbnacl/wiki/Authenticators
162
- [hashes]: https://github.com/cryptosphere/rbnacl/wiki/Hash-Functions
166
+ [wiki]: https://github.com/crypto-rb/rbnacl/wiki
167
+ [simplebox]: https://github.com/crypto-rb/rbnacl/wiki/SimpleBox
168
+ [secretkey]: https://github.com/crypto-rb/rbnacl/wiki/Secret-Key-Encryption
169
+ [publickey]: https://github.com/crypto-rb/rbnacl/wiki/Public-Key-Encryption
170
+ [signatures]: https://github.com/crypto-rb/rbnacl/wiki/Digital-Signatures
171
+ [macs]: https://github.com/crypto-rb/rbnacl/wiki/HMAC
172
+ [hashes]: https://github.com/crypto-rb/rbnacl/wiki/Hash-Functions
163
173
  [yard]: http://www.rubydoc.info/gems/rbnacl
164
174
 
165
175
  ## Learn More
@@ -209,7 +219,7 @@ Sure, here you go:
209
219
 
210
220
  ## License
211
221
 
212
- Copyright (c) 2012-2017 Tony Arcieri, Jonathan Stott. Distributed under the MIT License.
222
+ Copyright (c) 2012-2018 Tony Arcieri, Jonathan Stott. Distributed under the MIT License.
213
223
  See [LICENSE.txt] for further details.
214
224
 
215
- [LICENSE.txt]: https://github.com/cryptosphere/rbnacl/blob/master/LICENSE.txt
225
+ [LICENSE.txt]: https://github.com/crypto-rb/rbnacl/blob/master/LICENSE.txt
data/Rakefile CHANGED
@@ -1,7 +1,8 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  require "bundler/gem_tasks"
3
4
 
4
- Dir[File.expand_path("../tasks/**/*.rake", __FILE__)].each { |task| load task }
5
+ Dir[File.expand_path("tasks/**/*.rake", __dir__)].each { |task| load task }
5
6
 
6
- task default: %w(spec rubocop)
7
- task ci: %w(spec rubocop)
7
+ task default: %w[spec rubocop]
8
+ task ci: %w[spec rubocop]
@@ -1,6 +1,12 @@
1
1
  # encoding: binary
2
2
  # frozen_string_literal: true
3
3
 
4
+ if defined?(RBNACL_LIBSODIUM_GEM_LIB_PATH)
5
+ raise "rbnacl-libsodium is not supported by rbnacl 6.0+. "\
6
+ "Please remove it as a dependency and install libsodium using your system package manager. "\
7
+ "See https://github.com/crypto-rb/rbnacl#installation"
8
+ end
9
+
4
10
  require "rbnacl/version"
5
11
  require "rbnacl/sodium"
6
12
  require "rbnacl/sodium/version"
@@ -69,9 +75,7 @@ module RbNaCl
69
75
  # Password hash functions
70
76
  require "rbnacl/password_hash"
71
77
  require "rbnacl/password_hash/scrypt"
72
- if RbNaCl::Sodium::Version::ARGON2_SUPPORTED
73
- require "rbnacl/password_hash/argon2"
74
- end
78
+ require "rbnacl/password_hash/argon2" if RbNaCl::Sodium::Version::ARGON2_SUPPORTED
75
79
 
76
80
  # HMAC: SHA256/512 and SHA512256
77
81
  require "rbnacl/hmac/sha256"
@@ -81,6 +85,7 @@ module RbNaCl
81
85
  # AEAD: ChaCha20-Poly1305
82
86
  require "rbnacl/aead/chacha20poly1305_legacy"
83
87
  require "rbnacl/aead/chacha20poly1305_ietf"
88
+ require "rbnacl/aead/xchacha20poly1305_ietf"
84
89
 
85
90
  #
86
91
  # Bind aliases used by the public API
@@ -51,6 +51,7 @@ module RbNaCl
51
51
 
52
52
  success = do_encrypt(ciphertext, ciphertext_len, nonce, message, additional_data)
53
53
  raise CryptoError, "Encryption failed" unless success
54
+
54
55
  ciphertext
55
56
  end
56
57
 
@@ -72,6 +73,7 @@ module RbNaCl
72
73
 
73
74
  success = do_decrypt(message, message_len, nonce, ciphertext, additional_data)
74
75
  raise CryptoError, "Decryption failed. Ciphertext failed verification." unless success
76
+
75
77
  message
76
78
  end
77
79
 
@@ -128,6 +130,7 @@ module RbNaCl
128
130
 
129
131
  def data_len(data)
130
132
  return 0 if data.nil?
133
+
131
134
  data.bytesize
132
135
  end
133
136
 
@@ -17,11 +17,11 @@ module RbNaCl
17
17
 
18
18
  sodium_function :aead_chacha20poly1305_ietf_encrypt,
19
19
  :crypto_aead_chacha20poly1305_ietf_encrypt,
20
- [:pointer, :pointer, :pointer, :ulong_long, :pointer, :ulong_long, :pointer, :pointer, :pointer]
20
+ %i[pointer pointer pointer ulong_long pointer ulong_long pointer pointer pointer]
21
21
 
22
22
  sodium_function :aead_chacha20poly1305_ietf_decrypt,
23
23
  :crypto_aead_chacha20poly1305_ietf_decrypt,
24
- [:pointer, :pointer, :pointer, :pointer, :ulong_long, :pointer, :ulong_long, :pointer, :pointer]
24
+ %i[pointer pointer pointer pointer ulong_long pointer ulong_long pointer pointer]
25
25
 
26
26
  private
27
27