scrypty 0.0.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.
data/ext/sysendian.h ADDED
@@ -0,0 +1,140 @@
1
+ /*-
2
+ * Copyright 2007-2009 Colin Percival
3
+ * All rights reserved.
4
+ *
5
+ * Redistribution and use in source and binary forms, with or without
6
+ * modification, are permitted provided that the following conditions
7
+ * are met:
8
+ * 1. Redistributions of source code must retain the above copyright
9
+ * notice, this list of conditions and the following disclaimer.
10
+ * 2. Redistributions in binary form must reproduce the above copyright
11
+ * notice, this list of conditions and the following disclaimer in the
12
+ * documentation and/or other materials provided with the distribution.
13
+ *
14
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24
+ * SUCH DAMAGE.
25
+ *
26
+ * This file was originally written by Colin Percival as part of the Tarsnap
27
+ * online backup system.
28
+ */
29
+ #ifndef _SYSENDIAN_H_
30
+ #define _SYSENDIAN_H_
31
+
32
+ #include "scrypt_platform.h"
33
+
34
+ /* If we don't have be64enc, the <sys/endian.h> we have isn't usable. */
35
+ #if !HAVE_DECL_BE64ENC
36
+ #undef HAVE_SYS_ENDIAN_H
37
+ #endif
38
+
39
+ #ifdef HAVE_SYS_ENDIAN_H
40
+
41
+ #include <sys/endian.h>
42
+
43
+ #else
44
+
45
+ #include <stdint.h>
46
+
47
+ static inline uint32_t
48
+ be32dec(const void *pp)
49
+ {
50
+ const uint8_t *p = (uint8_t const *)pp;
51
+
52
+ return ((uint32_t)(p[3]) + ((uint32_t)(p[2]) << 8) +
53
+ ((uint32_t)(p[1]) << 16) + ((uint32_t)(p[0]) << 24));
54
+ }
55
+
56
+ static inline void
57
+ be32enc(void *pp, uint32_t x)
58
+ {
59
+ uint8_t * p = (uint8_t *)pp;
60
+
61
+ p[3] = x & 0xff;
62
+ p[2] = (x >> 8) & 0xff;
63
+ p[1] = (x >> 16) & 0xff;
64
+ p[0] = (x >> 24) & 0xff;
65
+ }
66
+
67
+ static inline uint64_t
68
+ be64dec(const void *pp)
69
+ {
70
+ const uint8_t *p = (uint8_t const *)pp;
71
+
72
+ return ((uint64_t)(p[7]) + ((uint64_t)(p[6]) << 8) +
73
+ ((uint64_t)(p[5]) << 16) + ((uint64_t)(p[4]) << 24) +
74
+ ((uint64_t)(p[3]) << 32) + ((uint64_t)(p[2]) << 40) +
75
+ ((uint64_t)(p[1]) << 48) + ((uint64_t)(p[0]) << 56));
76
+ }
77
+
78
+ static inline void
79
+ be64enc(void *pp, uint64_t x)
80
+ {
81
+ uint8_t * p = (uint8_t *)pp;
82
+
83
+ p[7] = x & 0xff;
84
+ p[6] = (x >> 8) & 0xff;
85
+ p[5] = (x >> 16) & 0xff;
86
+ p[4] = (x >> 24) & 0xff;
87
+ p[3] = (x >> 32) & 0xff;
88
+ p[2] = (x >> 40) & 0xff;
89
+ p[1] = (x >> 48) & 0xff;
90
+ p[0] = (x >> 56) & 0xff;
91
+ }
92
+
93
+ static inline uint32_t
94
+ le32dec(const void *pp)
95
+ {
96
+ const uint8_t *p = (uint8_t const *)pp;
97
+
98
+ return ((uint32_t)(p[0]) + ((uint32_t)(p[1]) << 8) +
99
+ ((uint32_t)(p[2]) << 16) + ((uint32_t)(p[3]) << 24));
100
+ }
101
+
102
+ static inline void
103
+ le32enc(void *pp, uint32_t x)
104
+ {
105
+ uint8_t * p = (uint8_t *)pp;
106
+
107
+ p[0] = x & 0xff;
108
+ p[1] = (x >> 8) & 0xff;
109
+ p[2] = (x >> 16) & 0xff;
110
+ p[3] = (x >> 24) & 0xff;
111
+ }
112
+
113
+ static inline uint64_t
114
+ le64dec(const void *pp)
115
+ {
116
+ const uint8_t *p = (uint8_t const *)pp;
117
+
118
+ return ((uint64_t)(p[0]) + ((uint64_t)(p[1]) << 8) +
119
+ ((uint64_t)(p[2]) << 16) + ((uint64_t)(p[3]) << 24) +
120
+ ((uint64_t)(p[4]) << 32) + ((uint64_t)(p[5]) << 40) +
121
+ ((uint64_t)(p[6]) << 48) + ((uint64_t)(p[7]) << 56));
122
+ }
123
+
124
+ static inline void
125
+ le64enc(void *pp, uint64_t x)
126
+ {
127
+ uint8_t * p = (uint8_t *)pp;
128
+
129
+ p[0] = x & 0xff;
130
+ p[1] = (x >> 8) & 0xff;
131
+ p[2] = (x >> 16) & 0xff;
132
+ p[3] = (x >> 24) & 0xff;
133
+ p[4] = (x >> 32) & 0xff;
134
+ p[5] = (x >> 40) & 0xff;
135
+ p[6] = (x >> 48) & 0xff;
136
+ p[7] = (x >> 56) & 0xff;
137
+ }
138
+ #endif /* !HAVE_SYS_ENDIAN_H */
139
+
140
+ #endif /* !_SYSENDIAN_H_ */
@@ -0,0 +1,3 @@
1
+ module Scrypty
2
+ VERSION = "0.0.1"
3
+ end
data/lib/scrypty.rb ADDED
@@ -0,0 +1,2 @@
1
+ require "scrypty_ext"
2
+ require "scrypty/version"
data/scrypty.gemspec ADDED
@@ -0,0 +1,20 @@
1
+ # -*- encoding: utf-8 -*-
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'scrypty/version'
5
+
6
+ Gem::Specification.new do |gem|
7
+ gem.name = "scrypty"
8
+ gem.version = Scrypty::VERSION
9
+ gem.authors = ["Jeremy Stephens"]
10
+ gem.email = ["viking@pillageandplunder.net"]
11
+ gem.description = %q{Uses the scrypt algorithm by Colin Percival to encrypt/decrypt data}
12
+ gem.summary = %q{Utility to encrypt/decrypt data with the scrypt algorithm}
13
+ gem.homepage = "https://github.com/viking/scrypt-full"
14
+
15
+ gem.files = `git ls-files`.split($/)
16
+ gem.extensions = gem.files.grep(%r{extconf.rb})
17
+ gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
18
+ gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
19
+ gem.require_paths = ["lib"]
20
+ end
metadata ADDED
@@ -0,0 +1,73 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: scrypty
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Jeremy Stephens
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2012-12-05 00:00:00.000000000 Z
13
+ dependencies: []
14
+ description: Uses the scrypt algorithm by Colin Percival to encrypt/decrypt data
15
+ email:
16
+ - viking@pillageandplunder.net
17
+ executables: []
18
+ extensions:
19
+ - ext/extconf.rb
20
+ extra_rdoc_files: []
21
+ files:
22
+ - .gitignore
23
+ - Gemfile
24
+ - LICENSE.txt
25
+ - README.md
26
+ - Rakefile
27
+ - ext/crypto_aesctr.c
28
+ - ext/crypto_aesctr.h
29
+ - ext/crypto_scrypt-nosse.c.orig
30
+ - ext/crypto_scrypt-ref.c
31
+ - ext/crypto_scrypt-sse.c.orig
32
+ - ext/crypto_scrypt.h
33
+ - ext/extconf.rb
34
+ - ext/memlimit.c
35
+ - ext/memlimit.h
36
+ - ext/ruby_ext.c
37
+ - ext/scrypt_platform.h
38
+ - ext/scryptenc.c
39
+ - ext/scryptenc.h
40
+ - ext/scryptenc_cpuperf.c
41
+ - ext/scryptenc_cpuperf.h
42
+ - ext/sha256.c
43
+ - ext/sha256.h
44
+ - ext/sysendian.h
45
+ - lib/scrypty.rb
46
+ - lib/scrypty/version.rb
47
+ - scrypty.gemspec
48
+ homepage: https://github.com/viking/scrypt-full
49
+ licenses: []
50
+ post_install_message:
51
+ rdoc_options: []
52
+ require_paths:
53
+ - lib
54
+ required_ruby_version: !ruby/object:Gem::Requirement
55
+ none: false
56
+ requirements:
57
+ - - ! '>='
58
+ - !ruby/object:Gem::Version
59
+ version: '0'
60
+ required_rubygems_version: !ruby/object:Gem::Requirement
61
+ none: false
62
+ requirements:
63
+ - - ! '>='
64
+ - !ruby/object:Gem::Version
65
+ version: '0'
66
+ requirements: []
67
+ rubyforge_project:
68
+ rubygems_version: 1.8.23
69
+ signing_key:
70
+ specification_version: 3
71
+ summary: Utility to encrypt/decrypt data with the scrypt algorithm
72
+ test_files: []
73
+ has_rdoc: