diff options
author | Peter Dettman <peter.dettman@bouncycastle.org> | 2022-06-29 14:48:28 +0700 |
---|---|---|
committer | Peter Dettman <peter.dettman@bouncycastle.org> | 2022-06-29 14:48:28 +0700 |
commit | dfe15d07f82efdaa4cbd68b4180304b6e479c592 (patch) | |
tree | 227e73df84e77ac4b96ebfbe5cf37027aa04156c | |
parent | Cleanup NewLine handling (diff) | |
download | BouncyCastle.NET-ed25519-dfe15d07f82efdaa4cbd68b4180304b6e479c592.tar.xz |
Add Objects class
-rw-r--r-- | crypto/src/asn1/DERExternal.cs | 12 | ||||
-rw-r--r-- | crypto/src/util/Objects.cs | 10 | ||||
-rw-r--r-- | crypto/src/util/Platform.cs | 5 |
3 files changed, 16 insertions, 11 deletions
diff --git a/crypto/src/asn1/DERExternal.cs b/crypto/src/asn1/DERExternal.cs index 1806b5296..9fba95165 100644 --- a/crypto/src/asn1/DERExternal.cs +++ b/crypto/src/asn1/DERExternal.cs @@ -156,9 +156,9 @@ namespace Org.BouncyCastle.Asn1 protected override int Asn1GetHashCode() { - return Platform.GetHashCode(this.directReference) - ^ Platform.GetHashCode(this.indirectReference) - ^ Platform.GetHashCode(this.dataValueDescriptor) + return Objects.GetHashCode(this.directReference) + ^ Objects.GetHashCode(this.indirectReference) + ^ Objects.GetHashCode(this.dataValueDescriptor) ^ this.encoding ^ this.externalContent.GetHashCode(); } @@ -167,9 +167,9 @@ namespace Org.BouncyCastle.Asn1 { DerExternal that = asn1Object as DerExternal; return null != that - && Platform.Equals(this.directReference, that.directReference) - && Platform.Equals(this.indirectReference, that.indirectReference) - && Platform.Equals(this.dataValueDescriptor, that.dataValueDescriptor) + && Equals(this.directReference, that.directReference) + && Equals(this.indirectReference, that.indirectReference) + && Equals(this.dataValueDescriptor, that.dataValueDescriptor) && this.encoding == that.encoding && this.externalContent.Equals(that.externalContent); } diff --git a/crypto/src/util/Objects.cs b/crypto/src/util/Objects.cs new file mode 100644 index 000000000..4d49ac9de --- /dev/null +++ b/crypto/src/util/Objects.cs @@ -0,0 +1,10 @@ +namespace Org.BouncyCastle.Utilities +{ + public static class Objects + { + public static int GetHashCode(object obj) + { + return null == obj ? 0 : obj.GetHashCode(); + } + } +} diff --git a/crypto/src/util/Platform.cs b/crypto/src/util/Platform.cs index 7e79c64e1..75b728bd9 100644 --- a/crypto/src/util/Platform.cs +++ b/crypto/src/util/Platform.cs @@ -26,11 +26,6 @@ namespace Org.BouncyCastle.Utilities } } - internal static int GetHashCode(object obj) - { - return null == obj ? 0 : obj.GetHashCode(); - } - internal static void Dispose(IDisposable d) { d.Dispose(); |