KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > python > modules > sha


1 //copyright 2000 Finn Bock
2

3 package org.python.modules;
4
5 import org.python.core.*;
6
7 public class sha {
8     public int blocksize = 1;
9     public int digestsize = 20;
10     public int digest_size = digestsize;
11
12     public static String JavaDoc __doc__ =
13         "* Cryptix General License\n" +
14         "* Copyright (c) 1995, 1996, 1997, 1998, 1999, 2000 The Cryptix"+
15         " Foundation\n" +
16         "* Limited. All rights reserved.\n" +
17         "* \n" +
18         "* Redistribution and use in source and binary forms, with or\n" +
19         "* without modification, are permitted provided that the\n" +
20         "* following conditions are met:\n" +
21         "*\n" +
22         "* - Redistributions of source code must retain the copyright\n" +
23         "* notice, this list of conditions and the following disclaimer.\n"+
24         "* - Redistributions in binary form must reproduce the above\n" +
25         "* copyright notice, this list of conditions and the following\n" +
26         "* disclaimer in the documentation and/or other materials\n" +
27         "* provided with the distribution.\n" +
28         "*\n" +
29         "* THIS SOFTWARE IS PROVIDED BY THE CRYPTIX FOUNDATION LIMITED\n" +
30         "* AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED\n" +
31         "* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n" +
32         "* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR\n" +
33         "* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE CRYPTIX\n" +
34         "* FOUNDATION LIMITED OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,\n" +
35         "* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n" +
36         "* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\n" +
37         "* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;\n" +
38         "* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY\n" +
39         "* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n" +
40         "* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF\n" +
41         "* THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY\n" +
42         "* OF SUCH DAMAGE.\n";
43
44
45     public static SHA1 new$(PyObject[] args, String JavaDoc[] kws) {
46         ArgParser ap = new ArgParser("sha", args, kws, "string");
47         String JavaDoc cp = ap.getString(0, null);
48
49         SHA1 n = new SHA1();
50         if (cp != null)
51             n.update(cp.getBytes());
52         return n;
53     }
54
55
56     public static SHA1 sha$(PyObject[] args, String JavaDoc[] kws) {
57         return new$(args, kws);
58     }
59 }
60
Popular Tags