From 0c32cb8208b3043d8bc2cea3d0241e2751d5c144 Mon Sep 17 00:00:00 2001 From: Apolixit Date: Wed, 31 Jan 2024 23:07:15 +0100 Subject: [PATCH] Fix some Sonar issues --- Substrate.NetApi/Mnemonic.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Substrate.NetApi/Mnemonic.cs b/Substrate.NetApi/Mnemonic.cs index ae92bcf..9dc679c 100644 --- a/Substrate.NetApi/Mnemonic.cs +++ b/Substrate.NetApi/Mnemonic.cs @@ -234,7 +234,7 @@ public static string MnemonicToEntropy(string mnemonic, BIP39Wordlist wordlistTy var newChecksum = DeriveChecksumBits(entropyBytes); if (newChecksum != checksumBits) - throw new Exception("InvalidChecksum"); + throw new InvalidOperationException("InvalidChecksum"); var result = BitConverter .ToString(entropyBytes) @@ -259,7 +259,7 @@ private static void CheckValidEntropy(byte[] entropyBytes) private static string DeriveChecksumBits(byte[] entropyBytes) { var ent = entropyBytes.Length * 8; - var cs = (int)ent / 32; + var cs = ent / 32; var sha256Provider = SHA256.Create(); var hash = sha256Provider.ComputeHash(entropyBytes); @@ -302,7 +302,7 @@ private static Wordlist GetWordlist(BIP39Wordlist language) return new Portuguese(); default: - throw new Exception($"Unknown {language} in BIP39 implementation!"); + throw new InvalidOperationException($"Unknown {language} in BIP39 implementation!"); } }