Skip to content

Commit 76d7dae

Browse files
committed
Import the "digest" module and the submodules, from the Rough Ruby
project. ext/digest: This module provides the module Digest and the abstract class Digest::Base. ext/digest/md5 (which obsoletes ext/md5): This module provides the class Digest::MD5 which implements the MD5 Message-Digest Algorithm. ext/digest/rmd160: This module provides the class Digest::RMD160 which implements the RIPEMD-160 cryptographic hash function. ext/digest/sha1 (which obsoletes ext/sha1): This module provides the class Digest::SHA1 which implements the SHA-1 Secure Hash Algorithm. ext/digest/sha2: This module provides the classes Digest::SHA256, Digest::SHA384 and Digest::SHA512 which implement the SHA-256, SHA-384 and SHA-512 Secure Hash Algorithms, respectively. lib/md5.rb, lib/sha1.rb: These files are provided for backward compatibility. All these classes have the common API, which previously ext/md5 and ext/sha1 modules provided. While the new API keeps 100% backward compatibility, it has been enriched with several utility methods. Read digest.txt for further details. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@1609 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
1 parent 6ecd6fe commit 76d7dae

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

58 files changed

+3558
-784
lines changed

LEGAL

Lines changed: 56 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ missing/strftime.c:
118118
missing/strncasecmp.c:
119119
missing/strstr.c:
120120
missing/strtol.c:
121-
ext/sha1/sha1.[ch]:
121+
ext/digest/sha1/sha1.[ch]:
122122

123123
These files are all under public domain.
124124

@@ -199,8 +199,7 @@ missing/vsnprintf.c:
199199
From ftp://ftp.cs.berkeley.edu/pub/4bsd/README.Impt.License.Change
200200
paragraph 3 above is now null and void.
201201

202-
ext/md5/md5c.c:
203-
ext/md5/md5.h:
202+
ext/digest/md5/md5.[ch]:
204203

205204
These files are under the following license. Ruby uses modified
206205
versions of them.
@@ -226,6 +225,59 @@ ext/md5/md5.h:
226225
L. Peter Deutsch
227226
ghost@aladdin.com
228227

228+
ext/digest/rmd160/rmd160.[ch]:
229+
230+
These files have the following copyright information, and by the
231+
author we are allowed to use it under the new-style BSD license.
232+
233+
AUTHOR: Antoon Bosselaers, ESAT-COSIC
234+
(Arranged for libc by Todd C. Miller)
235+
DATE: 1 March 1996
236+
237+
Copyright (c) Katholieke Universiteit Leuven
238+
1996, All Rights Reserved
239+
240+
ext/digest/rmd160/rmd160hl.c:
241+
ext/digest/sha1/sha1hl.c:
242+
243+
These files are under the beer-ware license.
244+
245+
"THE BEER-WARE LICENSE" (Revision 42):
246+
<phk@login.dkuug.dk> wrote this file. As long as you retain this notice you
247+
can do whatever you want with this stuff. If we meet some day, and you think
248+
this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp
249+
250+
ext/digest/sha2/sha2.[ch]:
251+
ext/digest/sha2/sha2hl.c:
252+
253+
These files are under the new-style BSD license.
254+
255+
Copyright 2000 Aaron D. Gifford. All rights reserved.
256+
257+
Redistribution and use in source and binary forms, with or without
258+
modification, are permitted provided that the following conditions
259+
are met:
260+
1. Redistributions of source code must retain the above copyright
261+
notice, this list of conditions and the following disclaimer.
262+
2. Redistributions in binary form must reproduce the above copyright
263+
notice, this list of conditions and the following disclaimer in the
264+
documentation and/or other materials provided with the distribution.
265+
3. Neither the name of the copyright holder nor the names of contributors
266+
may be used to endorse or promote products derived from this software
267+
without specific prior written permission.
268+
269+
THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) AND CONTRIBUTOR(S) ``AS IS'' AND
270+
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
271+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
272+
ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR(S) OR CONTRIBUTOR(S) BE LIABLE
273+
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
274+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
275+
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
276+
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
277+
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
278+
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
279+
SUCH DAMAGE.
280+
229281
ext/nkf/nkf1.7/nkf.c:
230282

231283
This file is under the following license. So to speak, it is
@@ -243,7 +295,7 @@ ext/socket/addrinfo.h:
243295
ext/socket/getaddrinfo.c:
244296
ext/socket/getnameinfo.c:
245297

246-
These files are under the BSD license.
298+
These files are under the new-style BSD license.
247299

248300
Copyright (C) 1995, 1996, 1997, 1998, and 1999 WIDE Project.
249301
All rights reserved.

ext/Setup

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,16 @@
33
#GD
44
#curses
55
#dbm
6+
#digest
7+
#digest/md5
8+
#digest/rmd160
9+
#digest/sha1
10+
#digest/sha2
611
#etc
712
#fcntl
813
#kconv
9-
#md5
1014
#pty
1115
#sdbm
12-
#sha1
1316
#socket
1417
#tk
1518
#tcltklib

ext/Setup.dj

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,17 @@ option nodynamic
33
#GD
44
#curses
55
dbm
6+
digest
7+
digest/md5
8+
digest/rmd160
9+
digest/sha1
10+
digest/sha2
611
gdbm
712
#etc
813
fcntl
914
nkf
1015
marshal
11-
md5
1216
readline
1317
sdbm
14-
sha1
1518
#socket
1619
#tkutil

ext/Setup.emx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,18 @@ option nodynamic
33
#Win32API
44
curses
55
#dbm
6+
digest
7+
digest/md5
8+
digest/rmd160
9+
digest/sha1
10+
digest/sha2
611
etc
712
fcntl
813
#gdbm
9-
md5
1014
nkf
1115
#pty
1216
#readline
1317
#sdbm
14-
sha1
1518
socket
1619
#tcltklib
1720
#tk

ext/Setup.nt

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,20 @@
44
Win32API
55
#curses
66
#dbm
7+
digest
8+
digest/md5
9+
digest/rmd160
10+
digest/sha1
11+
digest/sha2
712
#etc
813
fcntl
914
#gdbm
1015
#gtk
1116
marshal
12-
md5
1317
nkf
1418
#pty
1519
#readline
1620
sdbm
17-
sha1
1821
socket
1922
#tcltklib
2023
#tk

ext/Setup.x68

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,14 @@ option nodynamic
33
#GD
44
#curses
55
dbm
6+
digest
7+
digest/md5
8+
digest/rmd160
9+
digest/sha1
10+
digest/sha2
611
#etc
712
fcntl
813
kconv
914
marshal
10-
md5
11-
sha1
1215
#socket
1316
#tkutil
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
Makefile
2+
mkmf.log

ext/digest/MANIFEST

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
MANIFEST
2+
defs.h
3+
digest.c
4+
digest.h
5+
digest.txt
6+
digest.txt.jp
7+
extconf.rb
8+
lib/md5.rb
9+
lib/sha1.rb
10+
test.rb
11+
test.sh

ext/digest/defs.h

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
/* -*- C -*-
2+
* $Id$
3+
*/
4+
5+
#ifndef DEFS_H
6+
#define DEFS_H
7+
8+
#include "ruby.h"
9+
#include <sys/types.h>
10+
11+
#if defined(HAVE_SYS_CDEFS_H)
12+
# include <sys/cdefs.h>
13+
#else
14+
# define __BEGIN_DECLS
15+
# define __END_DECLS
16+
#endif
17+
18+
#if defined(HAVE_INTTYPES_H)
19+
# include <inttypes.h>
20+
#else
21+
typedef unsigned char uint8_t;
22+
typedef unsigned int uint32_t;
23+
# if SIZEOF_LONG == 8
24+
typedef unsigned long uint64_t;
25+
# elif defined(__GNUC__)
26+
typedef unsigned long long uint64_t;
27+
# elif defined(_MSC_VER)
28+
typedef unsigned _int64 uint64_t;
29+
# else
30+
# error What is a 64bit integer type on this system?
31+
# endif
32+
#endif
33+
34+
#endif /* DEFS_H */

0 commit comments

Comments
 (0)