From: CryptoManiac Date: Wed, 2 Sep 2015 10:18:49 +0000 (+0300) Subject: Remove RIPEMD160, SHA1 and SHA256 classes. X-Git-Url: https://git.novaco.in/?p=NovacoinLibrary.git;a=commitdiff_plain;h=1f6b6ffe24de703593f20f5f881a2e797473621c Remove RIPEMD160, SHA1 and SHA256 classes. --- diff --git a/Novacoin/Novacoin.csproj b/Novacoin/Novacoin.csproj index 59481ac..b7b6318 100644 --- a/Novacoin/Novacoin.csproj +++ b/Novacoin/Novacoin.csproj @@ -122,10 +122,7 @@ - - - diff --git a/Novacoin/RIPEMD160.cs b/Novacoin/RIPEMD160.cs deleted file mode 100644 index 9d2c55f..0000000 --- a/Novacoin/RIPEMD160.cs +++ /dev/null @@ -1,54 +0,0 @@ -/** - * Novacoin classes library - * Copyright (C) 2015 Alex D. (balthazar.ad@gmail.com) - - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . - */ - -using Org.BouncyCastle.Crypto.Digests; - -namespace Novacoin -{ - /// - /// Representation of RIPEMD-160 hash. - /// - public class RIPEMD160 : Hash - { - /// - /// Computes RIPEMD160 hash using managed library - /// - // private static readonly RIPEMD160Managed _hasher160 = new RIPEMD160Managed(); - private static RipeMD160Digest _hasher160 = new RipeMD160Digest(); - - // 20 bytes - public override int hashSize - { - get { return _hasher160.GetDigestSize(); } - } - - public RIPEMD160() : base() { } - public RIPEMD160(byte[] bytes, int offset = 0) : base(bytes, offset) { } - public RIPEMD160(RIPEMD160 h) : base(h) { } - - public static RIPEMD160 Compute160(byte[] inputBytes) - { - var digest1 = new byte[_hasher160.GetDigestSize()]; - _hasher160.BlockUpdate(inputBytes, 0, inputBytes.Length); - _hasher160.DoFinal(digest1, 0); - - return new RIPEMD160(digest1); - } - } -} - diff --git a/Novacoin/SHA1.cs b/Novacoin/SHA1.cs deleted file mode 100644 index 05bac1d..0000000 --- a/Novacoin/SHA1.cs +++ /dev/null @@ -1,58 +0,0 @@ -/** - * Novacoin classes library - * Copyright (C) 2015 Alex D. (balthazar.ad@gmail.com) - - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . - */ - - -using System.Collections.Generic; -using System.Linq; -using Org.BouncyCastle.Crypto.Digests; - -namespace Novacoin -{ - /// - /// Representation of SHA-1 hash - /// - public class SHA1 : Hash - { - /// - /// Computes RIPEMD160 hash using managed library - /// - private static Sha1Digest _hasher1 = new Sha1Digest(); - - // 32 bytes - public override int hashSize - { - get { return _hasher1.GetDigestSize(); } - } - - public SHA1() : base() { } - public SHA1(byte[] bytes, int offset = 0) : base(bytes, offset) { } - public SHA1(SHA1 h) : base(h) { } - - - public static SHA1 Compute1(byte[] inputBytes) - { - var digest1 = new byte[_hasher1.GetDigestSize()]; - - _hasher1.BlockUpdate(inputBytes, 0, inputBytes.Length); - _hasher1.DoFinal(digest1, 0); - - return new SHA1(digest1); - } - } -} - diff --git a/Novacoin/SHA256.cs b/Novacoin/SHA256.cs deleted file mode 100644 index 4ceda48..0000000 --- a/Novacoin/SHA256.cs +++ /dev/null @@ -1,52 +0,0 @@ -/** - * Novacoin classes library - * Copyright (C) 2015 Alex D. (balthazar.ad@gmail.com) - - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . - */ - -using Org.BouncyCastle.Crypto.Digests; - -namespace Novacoin -{ - /// - /// Representation of SHA-256 hash - /// - public class SHA256 : Hash - { - private static Sha256Digest _hasher256 = new Sha256Digest(); - - // 32 bytes - public override int hashSize - { - get { return _hasher256.GetDigestSize(); } - } - - public SHA256() : base() { } - public SHA256(byte[] bytes, int offset = 0) : base(bytes, offset) { } - public SHA256(SHA256 h) : base(h) { } - - - public static SHA256 Compute256(byte[] inputBytes) - { - var digest1 = new byte[_hasher256.GetDigestSize()]; - - _hasher256.BlockUpdate(inputBytes, 0, inputBytes.Length); - _hasher256.DoFinal(digest1, 0); - - return new SHA256(digest1); - } - } -} -