(DISTFILES): Comment out a few missing files.
[mono-project.git] / mcs / class / Mono.Security / Mono.Security.Cryptography / SHA224.cs
blob921c10c220b7bbe8a80128c01175d5084ea9fd05
1 //
2 // Mono.Security.Cryptography SHA224 Class implementation
3 //
4 // Authors:
5 // Sebastien Pouliot <sebastien@ximian.com>
6 //
7 // Copyright (C) 2004 Novell, Inc (http://www.novell.com)
8 //
9 // Permission is hereby granted, free of charge, to any person obtaining
10 // a copy of this software and associated documentation files (the
11 // "Software"), to deal in the Software without restriction, including
12 // without limitation the rights to use, copy, modify, merge, publish,
13 // distribute, sublicense, and/or sell copies of the Software, and to
14 // permit persons to whom the Software is furnished to do so, subject to
15 // the following conditions:
16 //
17 // The above copyright notice and this permission notice shall be
18 // included in all copies or substantial portions of the Software.
19 //
20 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
21 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
22 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
23 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
24 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
25 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
26 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
29 using System.Security.Cryptography;
31 namespace Mono.Security.Cryptography {
33 // FIXME: Remove when (or if) SHA224 moves into corlib
34 // (as corlib already have the required constants).
35 internal sealed class SHAConstants {
37 private SHAConstants ()
39 // Never instantiated.
42 // SHA-224/256 Constants
43 // Represent the first 32 bits of the fractional parts of the
44 // cube roots of the first sixty-four prime numbers
45 public readonly static uint[] K1 = {
46 0x428A2F98, 0x71374491, 0xB5C0FBCF, 0xE9B5DBA5,
47 0x3956C25B, 0x59F111F1, 0x923F82A4, 0xAB1C5ED5,
48 0xD807AA98, 0x12835B01, 0x243185BE, 0x550C7DC3,
49 0x72BE5D74, 0x80DEB1FE, 0x9BDC06A7, 0xC19BF174,
50 0xE49B69C1, 0xEFBE4786, 0x0FC19DC6, 0x240CA1CC,
51 0x2DE92C6F, 0x4A7484AA, 0x5CB0A9DC, 0x76F988DA,
52 0x983E5152, 0xA831C66D, 0xB00327C8, 0xBF597FC7,
53 0xC6E00BF3, 0xD5A79147, 0x06CA6351, 0x14292967,
54 0x27B70A85, 0x2E1B2138, 0x4D2C6DFC, 0x53380D13,
55 0x650A7354, 0x766A0ABB, 0x81C2C92E, 0x92722C85,
56 0xA2BFE8A1, 0xA81A664B, 0xC24B8B70, 0xC76C51A3,
57 0xD192E819, 0xD6990624, 0xF40E3585, 0x106AA070,
58 0x19A4C116, 0x1E376C08, 0x2748774C, 0x34B0BCB5,
59 0x391C0CB3, 0x4ED8AA4A, 0x5B9CCA4F, 0x682E6FF3,
60 0x748F82EE, 0x78A5636F, 0x84C87814, 0x8CC70208,
61 0x90BEFFFA, 0xA4506CEB, 0xBEF9A3F7, 0xC67178F2
65 public abstract class SHA224 : HashAlgorithm {
67 public SHA224 ()
69 // SHA-224 hash length are 224 bits long
70 HashSizeValue = 224;
73 public static new SHA224 Create ()
75 // for this to work we must register ourself with CryptoConfig
76 return Create ("SHA224");
79 public static new SHA224 Create (string hashName)
81 object o = CryptoConfig.CreateFromName (hashName);
82 // in case machine.config isn't configured to use any SHA224 implementation
83 if (o == null) {
84 o = new SHA224Managed ();
86 return (SHA224) o;