bcrypt-ruby 2.1.4-x86-mingw32 → 3.0.0-x86-mingw32
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/.gitignore +1 -0
- data/CHANGELOG +5 -1
- data/COPYING +23 -28
- data/Gemfile.lock +29 -0
- data/README.md +184 -0
- data/Rakefile +1 -0
- data/bcrypt-ruby.gemspec +3 -3
- data/ext/mri/bcrypt_ext.c +67 -65
- data/ext/mri/crypt.c +57 -0
- data/ext/mri/crypt.h +13 -0
- data/ext/mri/{blowfish.c → crypt_blowfish.c} +472 -321
- data/ext/mri/crypt_gensalt.c +111 -0
- data/ext/mri/extconf.rb +24 -2
- data/ext/mri/ow-crypt.h +35 -0
- data/ext/mri/wrapper.c +255 -0
- data/lib/bcrypt.rb +10 -5
- data/lib/bcrypt_engine.rb +34 -0
- data/spec/bcrypt/engine_spec.rb +3 -3
- data/spec/bcrypt/password_spec.rb +11 -2
- metadata +19 -16
- data/README +0 -175
- data/ext/mri/bcrypt.c +0 -297
- data/ext/mri/bcrypt.h +0 -67
- data/ext/mri/blf.h +0 -86
data/ext/mri/bcrypt.h
DELETED
@@ -1,67 +0,0 @@
|
|
1
|
-
/*
|
2
|
-
* Copyright 1997 Niels Provos <provos@physnet.uni-hamburg.de>
|
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
|
-
* 3. All advertising materials mentioning features or use of this software
|
14
|
-
* must display the following acknowledgement:
|
15
|
-
* This product includes software developed by Niels Provos.
|
16
|
-
* 4. The name of the author may not be used to endorse or promote products
|
17
|
-
* derived from this software without specific prior written permission.
|
18
|
-
*
|
19
|
-
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
20
|
-
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
21
|
-
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
22
|
-
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
23
|
-
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
24
|
-
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
25
|
-
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
26
|
-
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
27
|
-
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
28
|
-
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
29
|
-
*/
|
30
|
-
|
31
|
-
#ifndef _BCRYPT_H_
|
32
|
-
#define _BCRYPT_H_
|
33
|
-
|
34
|
-
#include <stdint.h>
|
35
|
-
|
36
|
-
#define BCRYPT_VERSION '2'
|
37
|
-
#define BCRYPT_MAXSALT 16 /* Precomputation is just so nice */
|
38
|
-
#define BCRYPT_BLOCKS 6 /* Ciphertext blocks */
|
39
|
-
#define BCRYPT_MINROUNDS 16 /* we have log2(rounds) in salt */
|
40
|
-
#define BCRYPT_SALT_OUTPUT_SIZE (7 + (BCRYPT_MAXSALT * 4 + 2) / 3 + 1)
|
41
|
-
#define BCRYPT_OUTPUT_SIZE 128
|
42
|
-
|
43
|
-
/*
|
44
|
-
* Given a logarithmic cost parameter, generates a salt for use with bcrypt().
|
45
|
-
*
|
46
|
-
* output: the computed salt will be stored here. This buffer must be
|
47
|
-
* at least BCRYPT_SALT_OUTPUT_SIZE bytes. The result will be
|
48
|
-
* null-terminated.
|
49
|
-
* log_rounds: the logarithmic cost.
|
50
|
-
* rseed: a seed of BCRYPT_MAXSALT bytes. Should be obtained from a
|
51
|
-
* cryptographically secure random source.
|
52
|
-
* Returns: output
|
53
|
-
*/
|
54
|
-
char *ruby_bcrypt_gensalt(char *output, uint8_t log_rounds, uint8_t *rseed);
|
55
|
-
|
56
|
-
/*
|
57
|
-
* Given a secret and a salt, generates a salted hash (which you can then store safely).
|
58
|
-
*
|
59
|
-
* output: the computed salted hash will be stored here. This buffer must
|
60
|
-
* be at least BCRYPT_OUTPUT_SIZE bytes, and will become null-terminated.
|
61
|
-
* key: A null-terminated secret.
|
62
|
-
* salt: The salt, as generated by bcrypt_gensalt().
|
63
|
-
* Returns: output on success, NULL on error.
|
64
|
-
*/
|
65
|
-
char *ruby_bcrypt(char *output, const char *key, const char *salt);
|
66
|
-
|
67
|
-
#endif /* _BCRYPT_H_ */
|
data/ext/mri/blf.h
DELETED
@@ -1,86 +0,0 @@
|
|
1
|
-
/* $OpenBSD: blf.h,v 1.6 2002/02/16 21:27:17 millert Exp $ */
|
2
|
-
/*
|
3
|
-
* Blowfish - a fast block cipher designed by Bruce Schneier
|
4
|
-
*
|
5
|
-
* Copyright 1997 Niels Provos <provos@physnet.uni-hamburg.de>
|
6
|
-
* All rights reserved.
|
7
|
-
*
|
8
|
-
* Redistribution and use in source and binary forms, with or without
|
9
|
-
* modification, are permitted provided that the following conditions
|
10
|
-
* are met:
|
11
|
-
* 1. Redistributions of source code must retain the above copyright
|
12
|
-
* notice, this list of conditions and the following disclaimer.
|
13
|
-
* 2. Redistributions in binary form must reproduce the above copyright
|
14
|
-
* notice, this list of conditions and the following disclaimer in the
|
15
|
-
* documentation and/or other materials provided with the distribution.
|
16
|
-
* 3. All advertising materials mentioning features or use of this software
|
17
|
-
* must display the following acknowledgement:
|
18
|
-
* This product includes software developed by Niels Provos.
|
19
|
-
* 4. The name of the author may not be used to endorse or promote products
|
20
|
-
* derived from this software without specific prior written permission.
|
21
|
-
*
|
22
|
-
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
23
|
-
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
24
|
-
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
25
|
-
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
26
|
-
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
27
|
-
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
28
|
-
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
29
|
-
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
30
|
-
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
31
|
-
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
32
|
-
*/
|
33
|
-
|
34
|
-
#ifndef _BLF_H_
|
35
|
-
#define _BLF_H_
|
36
|
-
|
37
|
-
#include <stdint.h>
|
38
|
-
|
39
|
-
// Imported from pwd.h. <coda.hale@gmail.com>
|
40
|
-
#define _PASSWORD_LEN 128 /* max length, not counting NUL */
|
41
|
-
|
42
|
-
/* Schneier specifies a maximum key length of 56 bytes.
|
43
|
-
* This ensures that every key bit affects every cipher
|
44
|
-
* bit. However, the subkeys can hold up to 72 bytes.
|
45
|
-
* Warning: For normal blowfish encryption only 56 bytes
|
46
|
-
* of the key affect all cipherbits.
|
47
|
-
*/
|
48
|
-
|
49
|
-
#define BLF_N 16 /* Number of Subkeys */
|
50
|
-
#define BLF_MAXKEYLEN ((BLF_N-2)*4) /* 448 bits */
|
51
|
-
|
52
|
-
/* Blowfish context */
|
53
|
-
typedef struct BlowfishContext {
|
54
|
-
uint32_t S[4][256]; /* S-Boxes */
|
55
|
-
uint32_t P[BLF_N + 2]; /* Subkeys */
|
56
|
-
} blf_ctx;
|
57
|
-
|
58
|
-
/* Raw access to customized Blowfish
|
59
|
-
* blf_key is just:
|
60
|
-
* Blowfish_initstate( state )
|
61
|
-
* Blowfish_expand0state( state, key, keylen )
|
62
|
-
*/
|
63
|
-
|
64
|
-
void Blowfish_encipher(blf_ctx *, uint32_t *, uint32_t *);
|
65
|
-
void Blowfish_decipher(blf_ctx *, uint32_t *, uint32_t *);
|
66
|
-
void Blowfish_initstate(blf_ctx *);
|
67
|
-
void Blowfish_expand0state(blf_ctx *, const uint8_t *, uint16_t);
|
68
|
-
void Blowfish_expandstate
|
69
|
-
(blf_ctx *, const uint8_t *, uint16_t, const uint8_t *, uint16_t);
|
70
|
-
|
71
|
-
/* Standard Blowfish */
|
72
|
-
|
73
|
-
void blf_key(blf_ctx *, const uint8_t *, uint16_t);
|
74
|
-
void blf_enc(blf_ctx *, uint32_t *, uint16_t);
|
75
|
-
void blf_dec(blf_ctx *, uint32_t *, uint16_t);
|
76
|
-
|
77
|
-
void blf_ecb_encrypt(blf_ctx *, uint8_t *, uint32_t);
|
78
|
-
void blf_ecb_decrypt(blf_ctx *, uint8_t *, uint32_t);
|
79
|
-
|
80
|
-
void blf_cbc_encrypt(blf_ctx *, uint8_t *, uint8_t *, uint32_t);
|
81
|
-
void blf_cbc_decrypt(blf_ctx *, uint8_t *, uint8_t *, uint32_t);
|
82
|
-
|
83
|
-
/* Converts uint8_t to uint32_t */
|
84
|
-
uint32_t Blowfish_stream2word(const uint8_t *, uint16_t , uint16_t *);
|
85
|
-
|
86
|
-
#endif
|