tweetnacl 0.2.0 → 0.3.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
  SHA1:
3
- metadata.gz: deaf1ed99efeefb3138a1b0c78e43e7cb1c1699e
4
- data.tar.gz: 73a15e0587d64171ef60723f879ed0f7e65631e8
3
+ metadata.gz: 3c1932fa8b635f8c885f09dc44235ddf4b8a0c82
4
+ data.tar.gz: 0b1a0d43b9f60f1885b20bde5b5916246601d872
5
5
  SHA512:
6
- metadata.gz: 048804948082736c35a551cfe6c54a1756330f8603ac2bc4eef8f9c31fdf3c42b2a7a2c48775132a4a99d0e899136aa5ce8ba44e23718183f61d847f7d28e4bc
7
- data.tar.gz: 378798dffd4d8761e4f43447379ae7a2c14acc26f1d01efded7cddd50c99dd97c283c5d934d8862a8a659e2cbbcd03ce1991bb277003da92a609c7c55b215e1d
6
+ metadata.gz: 3d29a42561260b81947f4988443a41233561f38b7169772d9d488ce7376b8f7d93e92601d3903b00df13cb35b65b2e887a4e1b939e893fa55a1af728705b0bb8
7
+ data.tar.gz: e3bfb32b5a80d8e3cbe83e9522fb2f37320683ce5b7e30c1c43c38e325465e0debd27323c3c2c03b5e7ce790e76001361543cb3bf5093eef0dd7e704aed6f802
data/.gitignore CHANGED
@@ -1,2 +1,4 @@
1
1
  *.gem
2
2
  Gemfile.lock
3
+ lib/tweetnacl.bundle
4
+ tmp/
@@ -1,6 +1,14 @@
1
1
  # Releases
2
2
 
3
- ## UNRELEASED
3
+ ## UNRELEASED (0.4.0)
4
+
5
+ ## 0.3.0 - Aug 19th 2014
6
+
7
+ * Added crypto\_sign\_key\_pair
8
+ * Added crypto\_sign
9
+ * Added crypto\_sign\_open
10
+ * Added a CryptoBox class to the Ruby API
11
+ * Added the C #define's to the Ruby API as constants under the TweetNacl module
4
12
 
5
13
  ## 0.2.0
6
14
 
data/README.md CHANGED
@@ -16,16 +16,58 @@ For a detailed explanation of TweetNaCl, [here's the research paper associated w
16
16
  input = "<text to cipher>"
17
17
  nonce = "<a 24-char string>"
18
18
 
19
- @t = TweetNaCl.new
19
+ pk, sk = TweetNaCl.crypto_box_keypair # This generates a pair of public and secret keys
20
20
 
21
- pk, sk = @t.crypto_box_keypair # This generates a pair of public and secret keys
21
+ cipher = TweetNaCl.crypto_box(input, nonce, pk, sk) # Encrypt !
22
22
 
23
- cipher = @t.crypto_box(input, nonce, pk, sk) # Encrypt !
24
-
25
- output = @t.crypto_box_open(cipher, nonce, pk, sk) # Decrypt!
23
+ output = TweetNaCl.crypto_box_open(cipher, nonce, pk, sk) # Decrypt!
26
24
 
27
25
  assert_equal input, output # They're the same !
28
26
 
27
+ ## RUBY API
28
+
29
+ ### KeyPair
30
+
31
+ A KeyPair object represents a pair of public and secret keys. They are created
32
+ with the `crypto_box_keypair` function call.
33
+
34
+ keypair = KeyPair.new
35
+
36
+ One can also create a keypair with an existing tuple of keys like this:
37
+
38
+ keypair = KeyPair.new(["<public_key>","<private_key>"])
39
+
40
+
41
+ ### CryptoBox
42
+
43
+ #### initialize / new (<optional: Keypair object>)
44
+ A Cryptobox object contains all the methods required to sign, encrypt and verify
45
+ messages. It is instantiated like so:
46
+
47
+ cb = CryptoBox.new(<Optional: KeyPair object>)
48
+
49
+ if no KeyPair is given, `CryptoBox` will create a new one by calling `KeyPair.new`
50
+
51
+ #### close(message, nonce)
52
+
53
+ Closing a box requires a message and a nonce.
54
+
55
+ cb = CryptBox.new(keypair_to_encrypt)
56
+ cb.close("hello world", "<a 24-byte nonce>")
57
+
58
+ #### open(box, nonce)
59
+
60
+ Opening a box requires a closed box and a nonce.
61
+
62
+ [...]
63
+ closed_box = CryptBox.new(keypair_to_encrypt).tap do |b|
64
+ b.close("hello world", "<a 24-byte nonce>")
65
+ end
66
+
67
+ decryption_box = CryptBox.new(keypair_to_decrypt)
68
+ decryption_box.open(closed_box, "<a 24-byte nonce>")
69
+
70
+
29
71
  ## FUNCTIONS
30
72
 
31
73
  ### crypto_box_keypair
@@ -36,20 +78,65 @@ Generate a pair of public and secret keys.
36
78
 
37
79
  Encrypt and sign the input given the other parameters.
38
80
 
39
- ### crypto_box_keypair(ciphered_message, nonce, public_key, secret_key)
81
+ ### crypto_box_open(ciphered_message, nonce, public_key, secret_key)
40
82
 
41
83
  Decrypt and verify the signature of the ciphered message given the other parameters.
42
84
 
85
+ ### crypto_secretbox(input, nonce, public_key)
86
+
87
+ Encrypt the input given the other parameters.
88
+
89
+ ### crypto_secretbox_open(ciphered_message, nonce, public_key)
90
+
91
+ Decrypt the ciphered message given the other parameters.
92
+
93
+ ### crypto_sign_keypair
94
+
95
+ Generate a pair of public and secret keys.
96
+
97
+ ### crypto_sign(message, secret_key)
98
+
99
+ Sign a message with a secret key.
100
+
101
+ ### crypto_sign_open(message, public_key)
102
+
103
+ Verify the signature in message with a public key.
104
+
105
+
43
106
  ## TODO
44
107
 
108
+ ### Raw C-API
109
+ * [x] crypto_box (aliased crypto_box_curve25519xsalsa20poly1305)
110
+ * [x] crypto_box_open (aliased crypto_box_curve25519xsalsa20poly1305_open)
45
111
  * [x] crypto_box_keypair
46
- * [x] crypto_box
47
- * [x] crypto_box_open
48
- * [x] crypto_box_curve25519xsalsa20poly1305_keypair
49
- * [x] crypto_box_curve25519xsalsa20poly1305
50
- * [x] crypto_box_curve25519xsalsa20poly1305_open
51
- * [ ] All the other functions !
52
- * [ ] Use high-level objects
112
+ * [ ] crypto_box_beforenm
113
+ * [ ] crypto_box_afternm
114
+ * [ ] crypto_box_open_afternm
115
+ * [ ] crypto_core_salsa20
116
+ * [ ] crypto_core_hsalsa20
117
+ * [ ] crypto_hashblocks = crypto_hashblocks_sha512
118
+ * [ ] crypto_hash = crypto_hash_sha512
119
+ * [ ] crypto_onetimeauth = crypto_onetimeauth_poly1305
120
+ * [ ] crypto_onetimeauth_verify
121
+ * [ ] crypto_scalarmult = crypto_scalarmult_curve25519
122
+ * [ ] crypto_scalarmult_base
123
+ * [x] crypto_secretbox (aliased crypto_secretbox_xsalsa20poly1305)
124
+ * [x] crypto_secretbox_open (aliased crypto_secretbox_xsalsa20poly1305_open)
125
+ * [x] crypto_sign = crypto_sign_ed25519
126
+ * [x] crypto_sign_open
127
+ * [x] crypto_sign_keypair
128
+ * [ ] crypto_stream = crypto_stream_xsalsa20
129
+ * [ ] crypto_stream_xor
130
+ * [ ] crypto_stream_salsa20
131
+ * [ ] crypto_stream_salsa20_xor
132
+ * [ ] crypto_verify_16
133
+ * [ ] crypto_verify_32
134
+ * [ ] USDT / probes
135
+
136
+ ### Ruby API
137
+
138
+ * [x] CryptoBox object
139
+ * [x] CryptoSign object
53
140
 
54
141
  ## Is it PRODUCTION-READY?
55
142
 
data/Rakefile CHANGED
@@ -7,7 +7,7 @@ end
7
7
  require 'rake/testtask'
8
8
  Rake::TestTask.new do |t|
9
9
  t.libs << "test"
10
- t.pattern = "test/*_test.rb"
10
+ t.pattern = "test/**/*_test.rb"
11
11
  t.verbose = true
12
12
  t.warning = true
13
13
  end
@@ -1,22 +1,8 @@
1
- #include <ruby.h>
1
+ #include <ruby/ruby.h>
2
2
  #include <ruby/encoding.h>
3
3
  #include "tweetnacl.h"
4
4
  #define PADDING_LEN 32
5
5
 
6
- typedef struct {
7
- } TweetNaCl;
8
-
9
- static void tweetnacl_free() {
10
- }
11
-
12
- static VALUE tweetnacl_alloc(VALUE klass) {
13
- return Data_Wrap_Struct(klass, NULL, tweetnacl_free, ruby_xmalloc(sizeof(TweetNaCl)));
14
- }
15
-
16
- static VALUE tweetnacl_init(VALUE self) {
17
- return Qnil;
18
- }
19
-
20
6
  void hexdump(char * data, int len)
21
7
  {
22
8
  int i;
@@ -28,11 +14,13 @@ void hexdump(char * data, int len)
28
14
 
29
15
  VALUE m_crypto_box_keypair(VALUE self) {
30
16
  VALUE ary = rb_ary_new2(2);
31
- char *pk = calloc(crypto_box_PUBLICKEYBYTES, sizeof(unsigned char));
32
- char *sk = calloc(crypto_box_SECRETKEYBYTES, sizeof(unsigned char));
17
+ unsigned char *pk = calloc(crypto_box_PUBLICKEYBYTES, sizeof(unsigned char));
18
+ unsigned char *sk = calloc(crypto_box_SECRETKEYBYTES, sizeof(unsigned char));
19
+
33
20
  int res = crypto_box_keypair(pk, sk);
34
- pk[crypto_box_PUBLICKEYBYTES] = 0;
35
- sk[crypto_box_SECRETKEYBYTES] = 0;
21
+ // TODO: use an exception instead of exit()
22
+ if (0 != res) { rb_raise(rb_eRuntimeError, "crypto_box_keypair did not work. error %d\n", res); }
23
+
36
24
  rb_ary_store(ary, 0, rb_str_new(pk, crypto_box_PUBLICKEYBYTES));
37
25
  rb_ary_store(ary, 1, rb_str_new(sk, crypto_box_SECRETKEYBYTES));
38
26
  return ary;
@@ -40,6 +28,7 @@ VALUE m_crypto_box_keypair(VALUE self) {
40
28
 
41
29
  VALUE m_crypto_box(VALUE self, VALUE _m, VALUE _n, VALUE _pk, VALUE _sk) {
42
30
  if(_m == Qnil) { rb_raise(rb_eArgError, "A message should have been given"); }
31
+ if(_n == Qnil) { rb_raise(rb_eArgError, "A nonce should have been given"); }
43
32
  if(_pk == Qnil) { rb_raise(rb_eArgError, "Public key should have been given"); }
44
33
  if(_sk == Qnil) { rb_raise(rb_eArgError, "Secret key should have been given"); }
45
34
  if (RSTRING_LEN(_n) != 24) { rb_raise(rb_eArgError, "nonce should be 24-byte long"); }
@@ -55,6 +44,7 @@ VALUE m_crypto_box(VALUE self, VALUE _m, VALUE _n, VALUE _pk, VALUE _sk) {
55
44
  memcpy(padded_message + PADDING_LEN, message, strlen(message));
56
45
  char * c = malloc(strlen(message) + PADDING_LEN);
57
46
  int res = crypto_box(c, padded_message, len + PADDING_LEN, nonce, pk, sk);
47
+ // TODO: use an exception instead of exit()
58
48
  if (0 != res) { fprintf(stderr, "Something went wrong\n"); exit(res); }
59
49
  VALUE ret = rb_str_new(c, len + PADDING_LEN);
60
50
  return ret;
@@ -62,89 +52,298 @@ VALUE m_crypto_box(VALUE self, VALUE _m, VALUE _n, VALUE _pk, VALUE _sk) {
62
52
 
63
53
  VALUE m_crypto_box_open(VALUE self, VALUE _c, VALUE _n, VALUE _pk, VALUE _sk) {
64
54
  if(_c == Qnil) { rb_raise(rb_eArgError, "A cipher should have been given"); }
55
+ if(_n == Qnil) { rb_raise(rb_eArgError, "A nonce should have been given"); }
65
56
  if(_pk == Qnil) { rb_raise(rb_eArgError, "Public key should have been given"); }
66
57
  if(_sk == Qnil) { rb_raise(rb_eArgError, "Secret key should have been given"); }
67
- if (RSTRING_LEN(_n) != 24) { rb_raise(rb_eArgError, "nonce should be 24-byte long"); }
68
- if (RSTRING_LEN(_pk) != 32) { rb_raise(rb_eArgError, "public key should be 24-byte long"); }
69
- if (RSTRING_LEN(_sk) != 32) { rb_raise(rb_eArgError, "secret key should be 24-byte long"); }
58
+ if (RSTRING_LEN(_n) != crypto_box_NONCEBYTES) { rb_raise(rb_eArgError, "nonce should be %d-byte long", crypto_box_NONCEBYTES); }
59
+ if (RSTRING_LEN(_pk) != crypto_box_PUBLICKEYBYTES) { rb_raise(rb_eArgError, "public key should be %d-byte long", crypto_box_PUBLICKEYBYTES); }
60
+ if (RSTRING_LEN(_sk) != crypto_box_SECRETKEYBYTES) { rb_raise(rb_eArgError, "secret key should be %d-byte long", crypto_box_SECRETKEYBYTES); }
70
61
 
71
62
  unsigned char * c = RSTRING_PTR(_c);
72
63
  char * nonce = RSTRING_PTR(_n);
73
64
  char * pk = RSTRING_PTR(_pk);
74
65
  char * sk = RSTRING_PTR(_sk);
75
66
  int padded_mlen = rb_str_strlen(_c);
76
- char * message = calloc(padded_mlen, sizeof(char));
67
+ unsigned char * message = (unsigned char*)calloc(padded_mlen, sizeof(unsigned char));
77
68
 
78
69
  int res = crypto_box_open(message, c, padded_mlen, nonce, pk, sk);
79
- if (0 != res) { rb_raise(rb_eRuntimeError, "crypto_box_open did not work"); }
70
+ if (0 != res) { rb_raise(rb_eRuntimeError, "crypto_box_open did not work. error %d", res); }
80
71
 
81
- return rb_str_new2(message + PADDING_LEN);
82
- }
72
+ message[padded_mlen + 1] = 0;
83
73
 
84
- VALUE m_crypto_box_curve25519xsalsa20poly1305_keypair(VALUE self) {
85
- VALUE ary = rb_ary_new2(2);
86
- char *pk = calloc(crypto_box_curve25519xsalsa20poly1305_tweet_PUBLICKEYBYTES, sizeof(unsigned char));
87
- char *sk = calloc(crypto_box_curve25519xsalsa20poly1305_tweet_SECRETKEYBYTES, sizeof(unsigned char));
88
- int res = crypto_box_curve25519xsalsa20poly1305_keypair(pk, sk);
89
- pk[crypto_box_curve25519xsalsa20poly1305_tweet_PUBLICKEYBYTES] = 0;
90
- sk[crypto_box_curve25519xsalsa20poly1305_tweet_SECRETKEYBYTES] = 0;
91
- rb_ary_store(ary, 0, rb_str_new(pk, crypto_box_curve25519xsalsa20poly1305_tweet_PUBLICKEYBYTES));
92
- rb_ary_store(ary, 1, rb_str_new(sk, crypto_box_curve25519xsalsa20poly1305_tweet_SECRETKEYBYTES));
93
- return ary;
74
+ VALUE ret = rb_str_new2(message + PADDING_LEN);
75
+ return ret;
94
76
  }
95
77
 
96
- VALUE m_crypto_box_curve25519xsalsa20poly1305(VALUE self, VALUE _m, VALUE _n, VALUE _pk, VALUE _sk) {
78
+ VALUE m_crypto_secretbox(VALUE self, VALUE _m, VALUE _n, VALUE _k) {
97
79
  if(_m == Qnil) { rb_raise(rb_eArgError, "A message should have been given"); }
98
- if(_pk == Qnil) { rb_raise(rb_eArgError, "Public key should have been given"); }
99
- if(_sk == Qnil) { rb_raise(rb_eArgError, "Secret key should have been given"); }
80
+ if(_k == Qnil) { rb_raise(rb_eArgError, "Secret key should have been given"); }
100
81
  if (RSTRING_LEN(_n) != 24) { rb_raise(rb_eArgError, "nonce should be 24-byte long"); }
101
- if (RSTRING_LEN(_pk) != 32) { rb_raise(rb_eArgError, "public key should be 24-byte long"); }
102
- if (RSTRING_LEN(_sk) != 32) { rb_raise(rb_eArgError, "secret key should be 24-byte long"); }
82
+ if (RSTRING_LEN(_k) != 32) { rb_raise(rb_eArgError, "Secret key should be 24-byte long"); }
103
83
 
104
84
  char * message = RSTRING_PTR(_m);
105
85
  char * nonce = RSTRING_PTR(_n);
106
- char * pk = RSTRING_PTR(_pk);
107
- char * sk = RSTRING_PTR(_sk);
86
+ char * k = RSTRING_PTR(_k);
108
87
  int len = strlen(message);
109
88
  char * padded_message = (char*)calloc(sizeof(char), len + PADDING_LEN);
110
89
  memcpy(padded_message + PADDING_LEN, message, strlen(message));
111
90
  char * c = malloc(strlen(message) + PADDING_LEN);
112
- int res = crypto_box_curve25519xsalsa20poly1305(c, padded_message, len + PADDING_LEN, nonce, pk, sk);
91
+ int res = crypto_secretbox(c, padded_message, len + PADDING_LEN, nonce, k);
92
+ // TODO: use an exception instead of exit()
113
93
  if (0 != res) { fprintf(stderr, "Something went wrong\n"); exit(res); }
114
94
  VALUE ret = rb_str_new(c, len + PADDING_LEN);
115
95
  return ret;
116
96
  }
117
97
 
118
- VALUE m_crypto_box_curve25519xsalsa20poly1305_open(VALUE self, VALUE _c, VALUE _n, VALUE _pk, VALUE _sk) {
98
+ VALUE m_crypto_secretbox_open(VALUE self, VALUE _c, VALUE _n, VALUE _k) {
119
99
  if(_c == Qnil) { rb_raise(rb_eArgError, "A cipher should have been given"); }
120
- if(_pk == Qnil) { rb_raise(rb_eArgError, "Public key should have been given"); }
121
- if(_sk == Qnil) { rb_raise(rb_eArgError, "Secret key should have been given"); }
100
+ if(_k == Qnil) { rb_raise(rb_eArgError, "Secret key should have been given"); }
122
101
  if (RSTRING_LEN(_n) != 24) { rb_raise(rb_eArgError, "nonce should be 24-byte long"); }
123
- if (RSTRING_LEN(_pk) != 32) { rb_raise(rb_eArgError, "public key should be 24-byte long"); }
124
- if (RSTRING_LEN(_sk) != 32) { rb_raise(rb_eArgError, "secret key should be 24-byte long"); }
102
+ if (RSTRING_LEN(_k) != 32) { rb_raise(rb_eArgError, "secret key should be 24-byte long"); }
125
103
 
126
104
  unsigned char * c = RSTRING_PTR(_c);
127
105
  char * nonce = RSTRING_PTR(_n);
128
- char * pk = RSTRING_PTR(_pk);
129
- char * sk = RSTRING_PTR(_sk);
106
+ char * k = RSTRING_PTR(_k);
130
107
  int padded_mlen = rb_str_strlen(_c);
131
108
  char * message = calloc(padded_mlen, sizeof(char));
132
109
 
133
- int res = crypto_box_curve25519xsalsa20poly1305_open(message, c, padded_mlen, nonce, pk, sk);
134
- if (0 != res) { rb_raise(rb_eRuntimeError, "crypto_box_open did not work"); }
110
+ int res = crypto_secretbox_open(message, c, padded_mlen, nonce, k);
111
+ if (0 != res) { rb_raise(rb_eRuntimeError, "crypto_secretbox_open did not work"); }
135
112
 
136
113
  return rb_str_new2(message + PADDING_LEN);
137
114
  }
138
115
 
116
+ VALUE m_crypto_sign_keypair(VALUE self) {
117
+ VALUE ary = rb_ary_new2(2);
118
+ unsigned char *pk = (unsigned char*)calloc(crypto_sign_PUBLICKEYBYTES, sizeof(unsigned char));
119
+ unsigned char *sk = (unsigned char*)calloc(crypto_sign_SECRETKEYBYTES, sizeof(unsigned char));
120
+ int res = crypto_sign_keypair(pk, sk);
121
+ pk[crypto_sign_PUBLICKEYBYTES] = 0;
122
+ sk[crypto_sign_SECRETKEYBYTES] = 0;
123
+ rb_ary_store(ary, 0, rb_str_new(pk, crypto_sign_PUBLICKEYBYTES));
124
+ rb_ary_store(ary, 1, rb_str_new(sk, crypto_sign_SECRETKEYBYTES));
125
+ return ary;
126
+ }
127
+
128
+ VALUE m_crypto_sign(VALUE self, VALUE _m, VALUE _k) {
129
+ if(_m == Qnil) { rb_raise(rb_eArgError, "A message should have been given"); }
130
+ if(_k == Qnil) { rb_raise(rb_eArgError, "Secret key should have been given"); }
131
+ if (RSTRING_LEN(_k) != crypto_sign_SECRETKEYBYTES) { rb_raise(rb_eArgError, "Secret key should be %d-byte long", crypto_sign_SECRETKEYBYTES); }
132
+
133
+ unsigned char * message = RSTRING_PTR(_m);
134
+ int len = rb_str_strlen(_m);
135
+ unsigned char * c = (unsigned char*)calloc(sizeof(unsigned char), len + crypto_sign_BYTES);
136
+ char * k = RSTRING_PTR(_k);
137
+ unsigned long long int smlen = 0;
138
+
139
+ int res = crypto_sign(c, &smlen, message, len, k);
140
+ // TODO: use an exception instead of exit()
141
+ if (0 != res) { fprintf(stderr, "crypto_sign did not work\n"); exit(res); }
142
+ VALUE ret = rb_str_new(c, smlen);
143
+ return ret;
144
+ }
145
+
146
+ VALUE m_crypto_sign_open(VALUE self, VALUE _c, VALUE _k) {
147
+ if(_c == Qnil) { rb_raise(rb_eArgError, "A message should have been given"); }
148
+ if(_k == Qnil) { rb_raise(rb_eArgError, "Public key should have been given"); }
149
+ if (RSTRING_LEN(_k) != crypto_sign_PUBLICKEYBYTES) { rb_raise(rb_eArgError, "public key should be %d-byte long", crypto_sign_PUBLICKEYBYTES); }
150
+
151
+ unsigned char * cipher = RSTRING_PTR(_c);
152
+ int len = rb_str_strlen(_c);
153
+ unsigned char * message = (unsigned char*)calloc(sizeof(unsigned char), len + 1);
154
+ char * k = RSTRING_PTR(_k);
155
+ unsigned long long int mlen = 0;
156
+
157
+ int res = crypto_sign_open(message, &mlen, cipher, len, k);
158
+ message[len] = 0;
159
+ if (0 != res) { rb_raise(rb_eRuntimeError, "crypto_sign_open did not work. error %d\n", res); }
160
+ VALUE ret = rb_str_new(message, mlen);
161
+ return ret;
162
+ }
163
+
164
+
139
165
  void Init_tweetnacl() {
140
- VALUE c = rb_define_class("TweetNaCl", rb_cObject);
141
-
142
- rb_define_alloc_func(c, tweetnacl_alloc);
143
- rb_define_private_method(c, "initialize", RUBY_METHOD_FUNC(tweetnacl_init), 0);
144
- rb_define_method(c, "crypto_box_keypair", RUBY_METHOD_FUNC(m_crypto_box_keypair), 0);
145
- rb_define_method(c, "crypto_box", RUBY_METHOD_FUNC(m_crypto_box), 4);
146
- rb_define_method(c, "crypto_box_open", RUBY_METHOD_FUNC(m_crypto_box_open), 4);
147
- rb_define_method(c, "crypto_box_curve25519xsalsa20poly1305_keypair", RUBY_METHOD_FUNC(m_crypto_box_curve25519xsalsa20poly1305_keypair), 0);
148
- rb_define_method(c, "crypto_box_curve25519xsalsa20poly1305", RUBY_METHOD_FUNC(m_crypto_box_curve25519xsalsa20poly1305), 4);
149
- rb_define_method(c, "crypto_box_curve25519xsalsa20poly1305_open", RUBY_METHOD_FUNC(m_crypto_box_curve25519xsalsa20poly1305_open), 4);
166
+ VALUE c = rb_define_module("TweetNaCl");
167
+
168
+ rb_define_module_function(c , "crypto_box_keypair" , RUBY_METHOD_FUNC(m_crypto_box_keypair) , 0);
169
+
170
+ rb_define_module_function(c , "crypto_box" , RUBY_METHOD_FUNC(m_crypto_box) , 4);
171
+ rb_define_module_function(c , "crypto_box_open" , RUBY_METHOD_FUNC(m_crypto_box_open) , 4);
172
+ rb_define_module_function(c , "crypto_box_curve25519xsalsa20poly1305" , RUBY_METHOD_FUNC(m_crypto_box) , 4);
173
+ rb_define_module_function(c , "crypto_box_curve25519xsalsa20poly1305_open" , RUBY_METHOD_FUNC(m_crypto_box_open) , 4);
174
+
175
+ rb_define_module_function(c , "crypto_secretbox" , RUBY_METHOD_FUNC(m_crypto_secretbox) , 3);
176
+ rb_define_module_function(c , "crypto_secretbox_open" , RUBY_METHOD_FUNC(m_crypto_secretbox_open) , 3);
177
+ rb_define_module_function(c , "crypto_secretbox_xsalsa20poly1305" , RUBY_METHOD_FUNC(m_crypto_secretbox) , 3);
178
+ rb_define_module_function(c , "crypto_secretbox_xsalsa20poly1305_open" , RUBY_METHOD_FUNC(m_crypto_secretbox_open) , 3);
179
+
180
+ rb_define_module_function(c , "crypto_sign_keypair" , RUBY_METHOD_FUNC(m_crypto_sign_keypair) , 0);
181
+
182
+ rb_define_module_function(c , "crypto_sign" , RUBY_METHOD_FUNC(m_crypto_sign) , 2);
183
+ rb_define_module_function(c , "crypto_sign_ed25519" , RUBY_METHOD_FUNC(m_crypto_sign) , 2);
184
+ rb_define_module_function(c , "crypto_sign_open" , RUBY_METHOD_FUNC(m_crypto_sign_open) , 2);
185
+ rb_define_module_function(c , "crypto_sign_ed25519_open" , RUBY_METHOD_FUNC(m_crypto_sign_open) , 2);
186
+
187
+ rb_define_const(c , "CRYPTO_AUTH_PRIMITIVE" , rb_str_new2("hmacsha512256"));
188
+ rb_define_const(c , "CRYPTO_AUTH_BYTES" , INT2NUM(crypto_auth_hmacsha512256_BYTES));
189
+ rb_define_const(c , "CRYPTO_AUTH_KEYBYTES" , INT2NUM(crypto_auth_hmacsha512256_KEYBYTES));
190
+ rb_define_const(c , "CRYPTO_AUTH_IMPLEMENTATION" , rb_str_new2(crypto_auth_hmacsha512256_IMPLEMENTATION));
191
+ rb_define_const(c , "CRYPTO_AUTH_VERSION" , rb_str_new2(crypto_auth_hmacsha512256_VERSION));
192
+ rb_define_const(c , "CRYPTO_AUTH_HMACSHA512256_TWEET_BYTES" , INT2NUM(32));
193
+ rb_define_const(c , "CRYPTO_AUTH_HMACSHA512256_TWEET_KEYBYTES" , INT2NUM(32));
194
+ rb_define_const(c , "CRYPTO_AUTH_HMACSHA512256_TWEET_VERSION" , rb_str_new2("-"));
195
+ rb_define_const(c , "CRYPTO_AUTH_HMACSHA512256_BYTES" , INT2NUM(crypto_auth_hmacsha512256_tweet_BYTES));
196
+ rb_define_const(c , "CRYPTO_AUTH_HMACSHA512256_KEYBYTES" , INT2NUM(crypto_auth_hmacsha512256_tweet_KEYBYTES));
197
+ rb_define_const(c , "CRYPTO_AUTH_HMACSHA512256_VERSION" , rb_str_new2(crypto_auth_hmacsha512256_tweet_VERSION));
198
+ rb_define_const(c , "CRYPTO_AUTH_HMACSHA512256_IMPLEMENTATION" , rb_str_new2("crypto_auth/hmacsha512256/tweet"));
199
+ rb_define_const(c , "CRYPTO_BOX_PRIMITIVE" , rb_str_new2("curve25519xsalsa20poly1305"));
200
+ rb_define_const(c , "CRYPTO_BOX_PUBLICKEYBYTES" , INT2NUM(crypto_box_curve25519xsalsa20poly1305_PUBLICKEYBYTES));
201
+ rb_define_const(c , "CRYPTO_BOX_SECRETKEYBYTES" , INT2NUM(crypto_box_curve25519xsalsa20poly1305_SECRETKEYBYTES));
202
+ rb_define_const(c , "CRYPTO_BOX_BEFORENMBYTES" , INT2NUM(crypto_box_curve25519xsalsa20poly1305_BEFORENMBYTES));
203
+ rb_define_const(c , "CRYPTO_BOX_NONCEBYTES" , INT2NUM(crypto_box_curve25519xsalsa20poly1305_NONCEBYTES));
204
+ rb_define_const(c , "CRYPTO_BOX_ZEROBYTES" , INT2NUM(crypto_box_curve25519xsalsa20poly1305_ZEROBYTES));
205
+ rb_define_const(c , "CRYPTO_BOX_BOXZEROBYTES" , INT2NUM(crypto_box_curve25519xsalsa20poly1305_BOXZEROBYTES));
206
+ rb_define_const(c , "CRYPTO_BOX_IMPLEMENTATION" , rb_str_new2(crypto_box_curve25519xsalsa20poly1305_IMPLEMENTATION));
207
+ rb_define_const(c , "CRYPTO_BOX_VERSION" , rb_str_new2(crypto_box_curve25519xsalsa20poly1305_VERSION));
208
+ rb_define_const(c , "CRYPTO_BOX_CURVE25519XSALSA20POLY1305_TWEET_PUBLICKEYBYTES" , INT2NUM(32));
209
+ rb_define_const(c , "CRYPTO_BOX_CURVE25519XSALSA20POLY1305_TWEET_SECRETKEYBYTES" , INT2NUM(32));
210
+ rb_define_const(c , "CRYPTO_BOX_CURVE25519XSALSA20POLY1305_TWEET_BEFORENMBYTES" , INT2NUM(32));
211
+ rb_define_const(c , "CRYPTO_BOX_CURVE25519XSALSA20POLY1305_TWEET_NONCEBYTES" , INT2NUM(24));
212
+ rb_define_const(c , "CRYPTO_BOX_CURVE25519XSALSA20POLY1305_TWEET_ZEROBYTES" , INT2NUM(32));
213
+ rb_define_const(c , "CRYPTO_BOX_CURVE25519XSALSA20POLY1305_TWEET_BOXZEROBYTES" , INT2NUM(16));
214
+ rb_define_const(c , "CRYPTO_BOX_CURVE25519XSALSA20POLY1305_TWEET_VERSION" , rb_str_new2("-"));
215
+ rb_define_const(c , "CRYPTO_BOX_CURVE25519XSALSA20POLY1305_PUBLICKEYBYTES" , INT2NUM(crypto_box_curve25519xsalsa20poly1305_tweet_PUBLICKEYBYTES));
216
+ rb_define_const(c , "CRYPTO_BOX_CURVE25519XSALSA20POLY1305_SECRETKEYBYTES" , INT2NUM(crypto_box_curve25519xsalsa20poly1305_tweet_SECRETKEYBYTES));
217
+ rb_define_const(c , "CRYPTO_BOX_CURVE25519XSALSA20POLY1305_BEFORENMBYTES" , INT2NUM(crypto_box_curve25519xsalsa20poly1305_tweet_BEFORENMBYTES));
218
+ rb_define_const(c , "CRYPTO_BOX_CURVE25519XSALSA20POLY1305_NONCEBYTES" , INT2NUM(crypto_box_curve25519xsalsa20poly1305_tweet_NONCEBYTES));
219
+ rb_define_const(c , "CRYPTO_BOX_CURVE25519XSALSA20POLY1305_ZEROBYTES" , INT2NUM(crypto_box_curve25519xsalsa20poly1305_tweet_ZEROBYTES));
220
+ rb_define_const(c , "CRYPTO_BOX_CURVE25519XSALSA20POLY1305_BOXZEROBYTES" , INT2NUM(crypto_box_curve25519xsalsa20poly1305_tweet_BOXZEROBYTES));
221
+ rb_define_const(c , "CRYPTO_BOX_CURVE25519XSALSA20POLY1305_VERSION" , rb_str_new2(crypto_box_curve25519xsalsa20poly1305_tweet_VERSION));
222
+ rb_define_const(c , "CRYPTO_BOX_CURVE25519XSALSA20POLY1305_IMPLEMENTATION" , rb_str_new2("crypto_box/curve25519xsalsa20poly1305/tweet"));
223
+ rb_define_const(c , "CRYPTO_CORE_PRIMITIVE" , rb_str_new2("salsa20"));
224
+ rb_define_const(c , "CRYPTO_CORE_OUTPUTBYTES" , INT2NUM(crypto_core_salsa20_OUTPUTBYTES));
225
+ rb_define_const(c , "CRYPTO_CORE_INPUTBYTES" , INT2NUM(crypto_core_salsa20_INPUTBYTES));
226
+ rb_define_const(c , "CRYPTO_CORE_KEYBYTES" , INT2NUM(crypto_core_salsa20_KEYBYTES));
227
+ rb_define_const(c , "CRYPTO_CORE_CONSTBYTES" , INT2NUM(crypto_core_salsa20_CONSTBYTES));
228
+ rb_define_const(c , "CRYPTO_CORE_IMPLEMENTATION" , rb_str_new2(crypto_core_salsa20_IMPLEMENTATION));
229
+ rb_define_const(c , "CRYPTO_CORE_VERSION" , rb_str_new2(crypto_core_salsa20_VERSION));
230
+ rb_define_const(c , "CRYPTO_CORE_SALSA20_TWEET_OUTPUTBYTES" , INT2NUM(64));
231
+ rb_define_const(c , "CRYPTO_CORE_SALSA20_TWEET_INPUTBYTES" , INT2NUM(16));
232
+ rb_define_const(c , "CRYPTO_CORE_SALSA20_TWEET_KEYBYTES" , INT2NUM(32));
233
+ rb_define_const(c , "CRYPTO_CORE_SALSA20_TWEET_CONSTBYTES" , INT2NUM(16));
234
+ rb_define_const(c , "CRYPTO_CORE_SALSA20_TWEET_VERSION" , rb_str_new2("-"));
235
+ rb_define_const(c , "CRYPTO_CORE_SALSA20_OUTPUTBYTES" , INT2NUM(crypto_core_salsa20_tweet_OUTPUTBYTES));
236
+ rb_define_const(c , "CRYPTO_CORE_SALSA20_INPUTBYTES" , INT2NUM(crypto_core_salsa20_tweet_INPUTBYTES));
237
+ rb_define_const(c , "CRYPTO_CORE_SALSA20_KEYBYTES" , INT2NUM(crypto_core_salsa20_tweet_KEYBYTES));
238
+ rb_define_const(c , "CRYPTO_CORE_SALSA20_CONSTBYTES" , INT2NUM(crypto_core_salsa20_tweet_CONSTBYTES));
239
+ rb_define_const(c , "CRYPTO_CORE_SALSA20_VERSION" , rb_str_new2(crypto_core_salsa20_tweet_VERSION));
240
+ rb_define_const(c , "CRYPTO_CORE_SALSA20_IMPLEMENTATION" , rb_str_new2("crypto_core/salsa20/tweet"));
241
+ rb_define_const(c , "CRYPTO_CORE_HSALSA20_TWEET_OUTPUTBYTES" , INT2NUM(32));
242
+ rb_define_const(c , "CRYPTO_CORE_HSALSA20_TWEET_INPUTBYTES" , INT2NUM(16));
243
+ rb_define_const(c , "CRYPTO_CORE_HSALSA20_TWEET_KEYBYTES" , INT2NUM(32));
244
+ rb_define_const(c , "CRYPTO_CORE_HSALSA20_TWEET_CONSTBYTES" , INT2NUM(16));
245
+ rb_define_const(c , "CRYPTO_CORE_HSALSA20_TWEET_VERSION" , rb_str_new2("-"));
246
+ rb_define_const(c , "CRYPTO_CORE_HSALSA20_OUTPUTBYTES" , INT2NUM(crypto_core_hsalsa20_tweet_OUTPUTBYTES));
247
+ rb_define_const(c , "CRYPTO_CORE_HSALSA20_INPUTBYTES" , INT2NUM(crypto_core_hsalsa20_tweet_INPUTBYTES));
248
+ rb_define_const(c , "CRYPTO_CORE_HSALSA20_KEYBYTES" , INT2NUM(crypto_core_hsalsa20_tweet_KEYBYTES));
249
+ rb_define_const(c , "CRYPTO_CORE_HSALSA20_CONSTBYTES" , INT2NUM(crypto_core_hsalsa20_tweet_CONSTBYTES));
250
+ rb_define_const(c , "CRYPTO_CORE_HSALSA20_VERSION" , rb_str_new2(crypto_core_hsalsa20_tweet_VERSION));
251
+ rb_define_const(c , "CRYPTO_CORE_HSALSA20_IMPLEMENTATION" , rb_str_new2("crypto_core/hsalsa20/tweet"));
252
+ rb_define_const(c , "CRYPTO_HASHBLOCKS_PRIMITIVE" , rb_str_new2("sha512"));
253
+ rb_define_const(c , "CRYPTO_HASHBLOCKS_STATEBYTES" , INT2NUM(crypto_hashblocks_sha512_STATEBYTES));
254
+ rb_define_const(c , "CRYPTO_HASHBLOCKS_BLOCKBYTES" , INT2NUM(crypto_hashblocks_sha512_BLOCKBYTES));
255
+ rb_define_const(c , "CRYPTO_HASHBLOCKS_IMPLEMENTATION" , rb_str_new2(crypto_hashblocks_sha512_IMPLEMENTATION));
256
+ rb_define_const(c , "CRYPTO_HASHBLOCKS_VERSION" , rb_str_new2(crypto_hashblocks_sha512_VERSION));
257
+ rb_define_const(c , "CRYPTO_HASHBLOCKS_SHA512_TWEET_STATEBYTES" , INT2NUM(64));
258
+ rb_define_const(c , "CRYPTO_HASHBLOCKS_SHA512_TWEET_BLOCKBYTES" , INT2NUM(128));
259
+ rb_define_const(c , "CRYPTO_HASHBLOCKS_SHA512_TWEET_VERSION" , rb_str_new2("-"));
260
+ rb_define_const(c , "CRYPTO_HASHBLOCKS_SHA512_STATEBYTES" , INT2NUM(crypto_hashblocks_sha512_tweet_STATEBYTES));
261
+ rb_define_const(c , "CRYPTO_HASHBLOCKS_SHA512_BLOCKBYTES" , INT2NUM(crypto_hashblocks_sha512_tweet_BLOCKBYTES));
262
+ rb_define_const(c , "CRYPTO_HASHBLOCKS_SHA512_VERSION" , rb_str_new2(crypto_hashblocks_sha512_tweet_VERSION));
263
+ rb_define_const(c , "CRYPTO_HASHBLOCKS_SHA512_IMPLEMENTATION" , rb_str_new2("crypto_hashblocks/sha512/tweet"));
264
+ rb_define_const(c , "CRYPTO_HASHBLOCKS_SHA256_TWEET_STATEBYTES" , INT2NUM(32));
265
+ rb_define_const(c , "CRYPTO_HASHBLOCKS_SHA256_TWEET_BLOCKBYTES" , INT2NUM(64));
266
+ rb_define_const(c , "CRYPTO_HASHBLOCKS_SHA256_TWEET_VERSION" , rb_str_new2("-"));
267
+ rb_define_const(c , "CRYPTO_HASHBLOCKS_SHA256_STATEBYTES" , INT2NUM(crypto_hashblocks_sha256_tweet_STATEBYTES));
268
+ rb_define_const(c , "CRYPTO_HASHBLOCKS_SHA256_BLOCKBYTES" , INT2NUM(crypto_hashblocks_sha256_tweet_BLOCKBYTES));
269
+ rb_define_const(c , "CRYPTO_HASHBLOCKS_SHA256_VERSION" , rb_str_new2(crypto_hashblocks_sha256_tweet_VERSION));
270
+ rb_define_const(c , "CRYPTO_HASHBLOCKS_SHA256_IMPLEMENTATION" , rb_str_new2("crypto_hashblocks/sha256/tweet"));
271
+ rb_define_const(c , "CRYPTO_HASH_PRIMITIVE" , rb_str_new2("sha512"));
272
+ rb_define_const(c , "CRYPTO_HASH_BYTES" , INT2NUM(crypto_hash_sha512_BYTES));
273
+ rb_define_const(c , "CRYPTO_HASH_IMPLEMENTATION" , rb_str_new2(crypto_hash_sha512_IMPLEMENTATION));
274
+ rb_define_const(c , "CRYPTO_HASH_VERSION" , rb_str_new2(crypto_hash_sha512_VERSION));
275
+ rb_define_const(c , "CRYPTO_HASH_SHA512_TWEET_BYTES" , INT2NUM(64));
276
+ rb_define_const(c , "CRYPTO_HASH_SHA512_TWEET_VERSION" , rb_str_new2("-"));
277
+ rb_define_const(c , "CRYPTO_HASH_SHA512_BYTES" , INT2NUM(crypto_hash_sha512_tweet_BYTES));
278
+ rb_define_const(c , "CRYPTO_HASH_SHA512_VERSION" , rb_str_new2(crypto_hash_sha512_tweet_VERSION));
279
+ rb_define_const(c , "CRYPTO_HASH_SHA512_IMPLEMENTATION" , rb_str_new2("crypto_hash/sha512/tweet"));
280
+ rb_define_const(c , "CRYPTO_HASH_SHA256_TWEET_BYTES" , INT2NUM(32));
281
+ rb_define_const(c , "CRYPTO_HASH_SHA256_TWEET_VERSION" , rb_str_new2("-"));
282
+ rb_define_const(c , "CRYPTO_HASH_SHA256_BYTES" , INT2NUM(crypto_hash_sha256_tweet_BYTES));
283
+ rb_define_const(c , "CRYPTO_HASH_SHA256_VERSION" , rb_str_new2(crypto_hash_sha256_tweet_VERSION));
284
+ rb_define_const(c , "CRYPTO_HASH_SHA256_IMPLEMENTATION" , rb_str_new2("crypto_hash/sha256/tweet"));
285
+ rb_define_const(c , "CRYPTO_ONETIMEAUTH_PRIMITIVE" , rb_str_new2("poly1305"));
286
+ rb_define_const(c , "CRYPTO_ONETIMEAUTH_BYTES" , INT2NUM(crypto_onetimeauth_poly1305_BYTES));
287
+ rb_define_const(c , "CRYPTO_ONETIMEAUTH_KEYBYTES" , INT2NUM(crypto_onetimeauth_poly1305_KEYBYTES));
288
+ rb_define_const(c , "CRYPTO_ONETIMEAUTH_IMPLEMENTATION" , rb_str_new2(crypto_onetimeauth_poly1305_IMPLEMENTATION));
289
+ rb_define_const(c , "CRYPTO_ONETIMEAUTH_VERSION" , rb_str_new2(crypto_onetimeauth_poly1305_VERSION));
290
+ rb_define_const(c , "CRYPTO_ONETIMEAUTH_POLY1305_TWEET_BYTES" , INT2NUM(16));
291
+ rb_define_const(c , "CRYPTO_ONETIMEAUTH_POLY1305_TWEET_KEYBYTES" , INT2NUM(32));
292
+ rb_define_const(c , "CRYPTO_ONETIMEAUTH_POLY1305_TWEET_VERSION" , rb_str_new2("-"));
293
+ rb_define_const(c , "CRYPTO_ONETIMEAUTH_POLY1305_BYTES" , INT2NUM(crypto_onetimeauth_poly1305_tweet_BYTES));
294
+ rb_define_const(c , "CRYPTO_ONETIMEAUTH_POLY1305_KEYBYTES" , INT2NUM(crypto_onetimeauth_poly1305_tweet_KEYBYTES));
295
+ rb_define_const(c , "CRYPTO_ONETIMEAUTH_POLY1305_VERSION" , rb_str_new2(crypto_onetimeauth_poly1305_tweet_VERSION));
296
+ rb_define_const(c , "CRYPTO_ONETIMEAUTH_POLY1305_IMPLEMENTATION" , rb_str_new2("crypto_onetimeauth/poly1305/tweet"));
297
+ rb_define_const(c , "CRYPTO_SCALARMULT_PRIMITIVE" , rb_str_new2("curve25519"));
298
+ rb_define_const(c , "CRYPTO_SCALARMULT_BYTES" , INT2NUM(crypto_scalarmult_curve25519_BYTES));
299
+ rb_define_const(c , "CRYPTO_SCALARMULT_SCALARBYTES" , INT2NUM(crypto_scalarmult_curve25519_SCALARBYTES));
300
+ rb_define_const(c , "CRYPTO_SCALARMULT_IMPLEMENTATION" , rb_str_new2(crypto_scalarmult_curve25519_IMPLEMENTATION));
301
+ rb_define_const(c , "CRYPTO_SCALARMULT_VERSION" , rb_str_new2(crypto_scalarmult_curve25519_VERSION));
302
+ rb_define_const(c , "CRYPTO_SCALARMULT_CURVE25519_TWEET_BYTES" , INT2NUM(32));
303
+ rb_define_const(c , "CRYPTO_SCALARMULT_CURVE25519_TWEET_SCALARBYTES" , INT2NUM(32));
304
+ rb_define_const(c , "CRYPTO_SCALARMULT_CURVE25519_TWEET_VERSION" , rb_str_new2("-"));
305
+ rb_define_const(c , "CRYPTO_SCALARMULT_CURVE25519_BYTES" , INT2NUM(crypto_scalarmult_curve25519_tweet_BYTES));
306
+ rb_define_const(c , "CRYPTO_SCALARMULT_CURVE25519_SCALARBYTES" , INT2NUM(crypto_scalarmult_curve25519_tweet_SCALARBYTES));
307
+ rb_define_const(c , "CRYPTO_SCALARMULT_CURVE25519_VERSION" , rb_str_new2(crypto_scalarmult_curve25519_tweet_VERSION));
308
+ rb_define_const(c , "CRYPTO_SCALARMULT_CURVE25519_IMPLEMENTATION" , rb_str_new2("crypto_scalarmult/curve25519/tweet"));
309
+ rb_define_const(c , "CRYPTO_SECRETBOX_PRIMITIVE" , rb_str_new2("xsalsa20poly1305"));
310
+ rb_define_const(c , "CRYPTO_SECRETBOX_KEYBYTES" , INT2NUM(crypto_secretbox_xsalsa20poly1305_KEYBYTES));
311
+ rb_define_const(c , "CRYPTO_SECRETBOX_NONCEBYTES" , INT2NUM(crypto_secretbox_xsalsa20poly1305_NONCEBYTES));
312
+ rb_define_const(c , "CRYPTO_SECRETBOX_ZEROBYTES" , INT2NUM(crypto_secretbox_xsalsa20poly1305_ZEROBYTES));
313
+ rb_define_const(c , "CRYPTO_SECRETBOX_BOXZEROBYTES" , INT2NUM(crypto_secretbox_xsalsa20poly1305_BOXZEROBYTES));
314
+ rb_define_const(c , "CRYPTO_SECRETBOX_IMPLEMENTATION" , rb_str_new2(crypto_secretbox_xsalsa20poly1305_IMPLEMENTATION));
315
+ rb_define_const(c , "CRYPTO_SECRETBOX_VERSION" , rb_str_new2(crypto_secretbox_xsalsa20poly1305_VERSION));
316
+ rb_define_const(c , "CRYPTO_SECRETBOX_XSALSA20POLY1305_TWEET_KEYBYTES" , INT2NUM(32));
317
+ rb_define_const(c , "CRYPTO_SECRETBOX_XSALSA20POLY1305_TWEET_NONCEBYTES" , INT2NUM(24));
318
+ rb_define_const(c , "CRYPTO_SECRETBOX_XSALSA20POLY1305_TWEET_ZEROBYTES" , INT2NUM(32));
319
+ rb_define_const(c , "CRYPTO_SECRETBOX_XSALSA20POLY1305_TWEET_BOXZEROBYTES" , INT2NUM(16));
320
+ rb_define_const(c , "CRYPTO_SECRETBOX_XSALSA20POLY1305_TWEET_VERSION" , rb_str_new2("-"));
321
+ rb_define_const(c , "CRYPTO_SECRETBOX_XSALSA20POLY1305_KEYBYTES" , INT2NUM(crypto_secretbox_xsalsa20poly1305_tweet_KEYBYTES));
322
+ rb_define_const(c , "CRYPTO_SECRETBOX_XSALSA20POLY1305_NONCEBYTES" , INT2NUM(crypto_secretbox_xsalsa20poly1305_tweet_NONCEBYTES));
323
+ rb_define_const(c , "CRYPTO_SECRETBOX_XSALSA20POLY1305_ZEROBYTES" , INT2NUM(crypto_secretbox_xsalsa20poly1305_tweet_ZEROBYTES));
324
+ rb_define_const(c , "CRYPTO_SECRETBOX_XSALSA20POLY1305_BOXZEROBYTES" , INT2NUM(crypto_secretbox_xsalsa20poly1305_tweet_BOXZEROBYTES));
325
+ rb_define_const(c , "CRYPTO_SECRETBOX_XSALSA20POLY1305_VERSION" , rb_str_new2(crypto_secretbox_xsalsa20poly1305_tweet_VERSION));
326
+ rb_define_const(c , "CRYPTO_SECRETBOX_XSALSA20POLY1305_IMPLEMENTATION" , rb_str_new2("crypto_secretbox/xsalsa20poly1305/tweet"));
327
+ rb_define_const(c , "CRYPTO_SIGN_PRIMITIVE" , rb_str_new2("ed25519"));
328
+ rb_define_const(c , "CRYPTO_SIGN_BYTES" , INT2NUM(crypto_sign_ed25519_BYTES));
329
+ rb_define_const(c , "CRYPTO_SIGN_PUBLICKEYBYTES" , INT2NUM(crypto_sign_ed25519_PUBLICKEYBYTES));
330
+ rb_define_const(c , "CRYPTO_SIGN_SECRETKEYBYTES" , INT2NUM(crypto_sign_ed25519_SECRETKEYBYTES));
331
+ rb_define_const(c , "CRYPTO_SIGN_IMPLEMENTATION" , rb_str_new2(crypto_sign_ed25519_IMPLEMENTATION));
332
+ rb_define_const(c , "CRYPTO_SIGN_VERSION" , rb_str_new2(crypto_sign_ed25519_VERSION));
333
+ rb_define_const(c , "CRYPTO_SIGN_ED25519_TWEET_BYTES" , INT2NUM(64));
334
+ rb_define_const(c , "CRYPTO_SIGN_ED25519_TWEET_PUBLICKEYBYTES" , INT2NUM(32));
335
+ rb_define_const(c , "CRYPTO_SIGN_ED25519_TWEET_SECRETKEYBYTES" , INT2NUM(64));
336
+ rb_define_const(c , "CRYPTO_SIGN_ED25519_TWEET_VERSION" , rb_str_new2("-"));
337
+ rb_define_const(c , "CRYPTO_SIGN_ED25519_BYTES" , INT2NUM(crypto_sign_ed25519_tweet_BYTES));
338
+ rb_define_const(c , "CRYPTO_SIGN_ED25519_PUBLICKEYBYTES" , INT2NUM(crypto_sign_ed25519_tweet_PUBLICKEYBYTES));
339
+ rb_define_const(c , "CRYPTO_SIGN_ED25519_SECRETKEYBYTES" , INT2NUM(crypto_sign_ed25519_tweet_SECRETKEYBYTES));
340
+ rb_define_const(c , "CRYPTO_SIGN_ED25519_VERSION" , rb_str_new2(crypto_sign_ed25519_tweet_VERSION));
341
+ rb_define_const(c , "CRYPTO_SIGN_ED25519_IMPLEMENTATION" , rb_str_new2("crypto_sign/ed25519/tweet"));
342
+ rb_define_const(c , "CRYPTO_STREAM_PRIMITIVE" , rb_str_new2("xsalsa20"));
343
+ rb_define_const(c , "CRYPTO_STREAM_KEYBYTES" , INT2NUM(crypto_stream_xsalsa20_KEYBYTES));
344
+ rb_define_const(c , "CRYPTO_STREAM_NONCEBYTES" , INT2NUM(crypto_stream_xsalsa20_NONCEBYTES));
345
+ rb_define_const(c , "CRYPTO_STREAM_IMPLEMENTATION" , rb_str_new2(crypto_stream_xsalsa20_IMPLEMENTATION));
346
+ rb_define_const(c , "CRYPTO_STREAM_VERSION" , rb_str_new2(crypto_stream_xsalsa20_VERSION));
347
+ rb_define_const(c , "CRYPTO_STREAM_XSALSA20_TWEET_KEYBYTES" , INT2NUM(32));
348
+ rb_define_const(c , "CRYPTO_STREAM_XSALSA20_TWEET_NONCEBYTES" , INT2NUM(24));
150
349
  }