01: /* This was:
02: * Id: SHA1.java,v 1.6 2001/06/25 15:39:55 gelderen Exp
03: * http://anoncvs.cryptix.org/cvs.php/projects/jce/src/cryptix.jce.provider.md/SHA1.java
04: * Copyright (C) 1995-2000 The Cryptix Foundation Limited.
05: * All rights reserved.
06: *
07: * Use, modification, copying and distribution of this software is subject to
08: * the terms and conditions of the Cryptix General Licence. You should have
09: * received a copy of the Cryptix General Licence along with this library;
10: * if not, you can download a copy from http://www.cryptix.org/
11: * Cryptix General License
12: * Copyright (C) 1995-2001 The Cryptix Foundation Limited. All rights reserved.
13:
14: * Redistribution and use in source and binary forms, with or without
15: * modification, are permitted provided that the following conditions
16: * are met:
17:
18: * Redistributions of source code must retain the copyright notice,
19: * this list of conditions and the following disclaimer.
20:
21: * Redistributions in binary form must reproduce the above copyright
22: * notice, this list of conditions and the following disclaimer in the
23: * documentation and/or other materials provided with the
24: * distribution.
25:
26: * THIS SOFTWARE IS PROVIDED BY THE CRYPTIX FOUNDATION LIMITED AND
27: * CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
28: * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
29: * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
30: * DISCLAIMED. IN NO EVENT SHALL THE CRYPTIX FOUNDATION LIMITED OR
31: * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
32: * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
33: * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
34: * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
35: * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
36: * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
37: * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
38: * SUCH DAMAGE.
39: */
40:
41: package uk.org.ponder.hashutil;
42:
43: /**
44: * SHA-1 message digest algorithm.
45: *
46: * @version Revision: 1.6
47: * @author Jeroen C. van Gelderen
48: * @author Antranig Basman.
49: */
50: public final class SHA1 extends SHA implements Cloneable {
51:
52: // Constructors
53: //...........................................................................
54:
55: public SHA1() {
56: super ();
57: }
58:
59: private SHA1(SHA1 src) {
60: super (src);
61: }
62:
63: public Object clone() {
64: return new SHA1(this );
65: }
66:
67: // Concreteness
68: //...........................................................................
69:
70: protected void expand(int[] W) {
71: // expand the block to 80 words, according to the SHA1 spec
72: for (int i = 16; i < 80; i++) {
73: int j = W[i - 16] ^ W[i - 14] ^ W[i - 8] ^ W[i - 3];
74: W[i] = (j << 1) | (j >>> -1);
75: }
76: }
77: }
|