rubytea 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +12 -0
- data/ext/tea.c +10 -1
- data/rubytea.gemspec +4 -1
- metadata +6 -5
data/README.md
ADDED
@@ -0,0 +1,12 @@
|
|
1
|
+
Usage
|
2
|
+
=====
|
3
|
+
|
4
|
+
key = TEA::Key.new(1234, 4567, 2345, 3456)
|
5
|
+
data = "bobafett".unpack("N*") # (needs to be a multiple of 4 bytes long)
|
6
|
+
|
7
|
+
TEA.encrypt!(data, key) # encrypts your integer array in place; returns it for convenience
|
8
|
+
|
9
|
+
TEA.decrypt!(data, key) # in place too
|
10
|
+
data.pack("N*") # => "bobafett"
|
11
|
+
|
12
|
+
|
data/ext/tea.c
CHANGED
@@ -78,9 +78,18 @@ VALUE tkey_init_copy(VALUE copy, VALUE orig) {
|
|
78
78
|
|
79
79
|
VALUE rubytea_exec(VALUE self, VALUE data, VALUE rkey, char op)
|
80
80
|
{
|
81
|
+
if (rb_obj_is_kind_of(data, rb_cArray) != Qtrue)
|
82
|
+
{
|
83
|
+
rb_raise(rb_eArgError, "Invalid data passed to TEA::encrypt(): array of integers expected");
|
84
|
+
return Qnil;
|
85
|
+
}
|
81
86
|
int len = RARRAY_LEN(data);
|
82
87
|
int i;
|
83
|
-
if (len < 2)
|
88
|
+
if (len < 2)
|
89
|
+
{
|
90
|
+
rb_raise(rb_eArgError, "TEA::encrypt() can only encrypt an array with two or more ints");
|
91
|
+
return Qnil;
|
92
|
+
}
|
84
93
|
size_t c = sizeof(uint32_t) * len;
|
85
94
|
uint32_t *ptr = ALLOCA_N(uint32_t, len);
|
86
95
|
|
data/rubytea.gemspec
CHANGED
@@ -1,8 +1,11 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = 'rubytea'
|
3
|
-
s.version = '0.1.
|
3
|
+
s.version = '0.1.1'
|
4
4
|
s.files = `git ls-files`.split("\n")
|
5
5
|
s.extensions = ["ext/extconf.rb"]
|
6
|
+
s.author = 'James Fairbairn'
|
7
|
+
s.email = 'james@netlagoon.com'
|
8
|
+
s.homepage = 'https://github.com/jfairbairn/rubytea'
|
6
9
|
|
7
10
|
s.require_paths = %w(ext)
|
8
11
|
s.summary = "A wrapper around the XXTEA block encryption algorithm"
|
metadata
CHANGED
@@ -2,10 +2,10 @@
|
|
2
2
|
name: rubytea
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.1.
|
5
|
+
version: 0.1.1
|
6
6
|
platform: ruby
|
7
|
-
authors:
|
8
|
-
|
7
|
+
authors:
|
8
|
+
- James Fairbairn
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
@@ -25,7 +25,7 @@ dependencies:
|
|
25
25
|
type: :development
|
26
26
|
version_requirements: *id001
|
27
27
|
description:
|
28
|
-
email:
|
28
|
+
email: james@netlagoon.com
|
29
29
|
executables: []
|
30
30
|
|
31
31
|
extensions:
|
@@ -33,12 +33,13 @@ extensions:
|
|
33
33
|
extra_rdoc_files: []
|
34
34
|
|
35
35
|
files:
|
36
|
+
- README.md
|
36
37
|
- ext/.gitignore
|
37
38
|
- ext/extconf.rb
|
38
39
|
- ext/tea.c
|
39
40
|
- rubytea.gemspec
|
40
41
|
has_rdoc: true
|
41
|
-
homepage:
|
42
|
+
homepage: https://github.com/jfairbairn/rubytea
|
42
43
|
licenses: []
|
43
44
|
|
44
45
|
post_install_message:
|