Edit consts names
MODIFY
WalletWasabi/Crypto/StringCipher.cs
WalletWasabi/Crypto/StringCipher.cs
@@ -11,7 +11,7 @@ namespace WalletWasabi.Crypto
{
// This constant is used to determine the keysize of the encryption algorithm in bits.
// We divide this by 8 within the code below to get the equivalent number of bytes.
- private const int Keysize = 128;
+ private const int KeySize = 128;
// This constant determines the number of iterations for the password bytes generation function.
private const int DerivationIterations = 1000;
@@ -28,7 +28,7 @@ namespace WalletWasabi.Crypto
using (var password = new Rfc2898DeriveBytes(passPhrase, salt, DerivationIterations))
{
- key = password.GetBytes(Keysize / 8);
+ key = password.GetBytes(KeySize / 8);
using (var aes = CreateAES())
{
aes.GenerateIV();
@@ -81,15 +81,15 @@ namespace WalletWasabi.Crypto
var cipherLength = 0;
using (var reader = new BinaryReader(memoryStream, Encoding.UTF8, true))
{
- var salt = reader.ReadBytes(Keysize / 8);
- iv = reader.ReadBytes(Keysize / 8);
+ var salt = reader.ReadBytes(KeySize / 8);
+ iv = reader.ReadBytes(KeySize / 8);
var authenticationCode = reader.ReadBytes(32);
cipherLength = (int)(memoryStream.Length - memoryStream.Position);
var cipher = reader.ReadBytes(cipherLength);
using (var password = new Rfc2898DeriveBytes(passPhrase, salt, DerivationIterations))
{
- key = password.GetBytes(Keysize / 8);
+ key = password.GetBytes(KeySize / 8);
}
using (var hmac = new HMACSHA256(key))

MODIFY
WalletWasabi/Gma/QrCodeNet/Encoding/DataEncodation/EightBitByteEncoder.cs
WalletWasabi/Gma/QrCodeNet/Encoding/DataEncodation/EightBitByteEncoder.cs
@@ -37,7 +37,7 @@ namespace Gma.QrCodeNet.Encoding.DataEncodation
/// <summary>
/// Bitcount, Chapter 8.4.4, P.24
/// </summary>
- private const int EIGHT_BIT_BYTE_BITCOUNT = 8;
+ private const int EightBitByteBitcount = 8;
internal override BitList GetDataBits(string content)
{
@@ -64,13 +64,13 @@ namespace Gma.QrCodeNet.Encoding.DataEncodation
byte[] utf8BOM = QRCodeConstantVariable.UTF8ByteOrderMark;
for (int index = 0; index < utf8BOM.Length; index++)
{
- dataBits.Add(utf8BOM[index], EIGHT_BIT_BYTE_BITCOUNT);
+ dataBits.Add(utf8BOM[index], EightBitByteBitcount);
}
}
for (int index = 0; index < encodeContent.Length; index++)
{
- dataBits.Add(encodeContent[index], EIGHT_BIT_BYTE_BITCOUNT);
+ dataBits.Add(encodeContent[index], EightBitByteBitcount);
}
return dataBits;
}

MODIFY
WalletWasabi/Gma/QrCodeNet/Encoding/DataEncodation/InputRecognition/ModeEncodeCheck.cs
WalletWasabi/Gma/QrCodeNet/Encoding/DataEncodation/InputRecognition/ModeEncodeCheck.cs
@@ -13,7 +13,7 @@ namespace Gma.QrCodeNet.Encoding.DataEncodation.InputRecognition
/// Encoding.GetEncoding.GetBytes will transform char to 0x3F if that char not belong to current encoding table.
/// 0x3F is '?'
/// </summary>
- private const int QUESTION_MARK_CHAR = 0x3F;
+ private const int QuestionMarkChar = 0x3F;
private static bool EightBitByteCheck(string encodingName, string content)
{
@@ -54,7 +54,7 @@ namespace Gma.QrCodeNet.Encoding.DataEncodation.InputRecognition
currentChar[0] = content[index];
bytes = encoding.GetBytes(currentChar);
int length = bytes.Length;
- if (currentChar[0] != '?' && length == 1 && bytes[0] == QUESTION_MARK_CHAR)
+ if (currentChar[0] != '?' && length == 1 && bytes[0] == QuestionMarkChar)
{
return index;
}
@@ -69,7 +69,7 @@ namespace Gma.QrCodeNet.Encoding.DataEncodation.InputRecognition
currentChar[0] = content[index];
bytes = encoding.GetBytes(currentChar);
int length = bytes.Length;
- if (currentChar[0] != '?' && length == 1 && bytes[0] == QUESTION_MARK_CHAR)
+ if (currentChar[0] != '?' && length == 1 && bytes[0] == QuestionMarkChar)
{
return index;
}

MODIFY
WalletWasabi/Gma/QrCodeNet/Encoding/Versions/VersionControl.cs
WalletWasabi/Gma/QrCodeNet/Encoding/Versions/VersionControl.cs
@@ -5,8 +5,8 @@ namespace Gma.QrCodeNet.Encoding.Versions
{
internal static class VersionControl
{
- private const int NUM_BITS_MODE_INDICATOR = 4;
- private const string DEFAULT_ENCODING = QRCodeConstantVariable.DefaultEncoding;
+ private const int NumBitsModeIndicator = 4;
+ private const string DefaultEncoding = QRCodeConstantVariable.DefaultEncoding;
/// <summary>
/// Determine which version to use
@@ -22,7 +22,7 @@ namespace Gma.QrCodeNet.Encoding.Versions
BitList eciHeader = new BitList();
- if (encodingName != DEFAULT_ENCODING && encodingName != QRCodeConstantVariable.UTF8Encoding)
+ if (encodingName != DefaultEncoding && encodingName != QRCodeConstantVariable.UTF8Encoding)
{
ECISet eciSet = new ECISet(ECISet.AppendOption.NameToValue);
int eciValue = eciSet.GetECIValueByName(encodingName);
@@ -37,7 +37,7 @@ namespace Gma.QrCodeNet.Encoding.Versions
int[] charCountIndicator = CharCountIndicatorTable.GetCharCountIndicatorSet();
- totalDataBits += (NUM_BITS_MODE_INDICATOR + charCountIndicator[searchGroup]);
+ totalDataBits += (NumBitsModeIndicator + charCountIndicator[searchGroup]);
int lowerSearchBoundary = searchGroup == 0 ? 1 : (VERSION_GROUP[searchGroup - 1] + 1);
int higherSearchBoundary = VERSION_GROUP[searchGroup];
@@ -93,7 +93,7 @@ namespace Gma.QrCodeNet.Encoding.Versions
int loopLength = VERSION_GROUP.Length;
for (int i = 0; i < loopLength; i++)
{
- int totalBits = numBits + NUM_BITS_MODE_INDICATOR + charCountIndicator[i];
+ int totalBits = numBits + NumBitsModeIndicator + charCountIndicator[i];
QRCodeVersion version = VersionTable.GetVersionByNum(VERSION_GROUP[i]);
int numECCodewords = version.GetECBlocksByLevel(level).NumErrorCorrectionCodewards;
@@ -106,7 +106,7 @@ namespace Gma.QrCodeNet.Encoding.Versions
}
}
- throw new InputOutOfBoundaryException($"QRCode do not have enough space for {(numBits + NUM_BITS_MODE_INDICATOR + charCountIndicator[2])} bits");
+ throw new InputOutOfBoundaryException($"QRCode do not have enough space for {(numBits + NumBitsModeIndicator + charCountIndicator[2])} bits");
}
/// <summary>

MODIFY
WalletWasabi/Helpers/Constants.cs
WalletWasabi/Helpers/Constants.cs
@@ -11,26 +11,26 @@ namespace WalletWasabi.Helpers
public const string BackendMajorVersion = "3";
public static readonly VersionsResponse VersionsResponse = new VersionsResponse { ClientVersion = ClientVersion.ToString(), BackendMajorVersion = BackendMajorVersion };
- public const uint ProtocolVersion_WITNESS_VERSION = 70012;
+ public const uint ProtocolVersionWitnessVersion = 70012;
public static readonly NodeRequirement NodeRequirements = new NodeRequirement
{
RequiredServices = NodeServices.NODE_WITNESS,
- MinVersion = ProtocolVersion_WITNESS_VERSION,
+ MinVersion = ProtocolVersionWitnessVersion,
MinProtocolCapabilities = new ProtocolCapabilities { SupportGetBlock = true, SupportWitness = true, SupportMempoolQuery = true }
};
public static readonly NodeRequirement LocalNodeRequirements = new NodeRequirement
{
RequiredServices = NodeServices.NODE_WITNESS,
- MinVersion = ProtocolVersion_WITNESS_VERSION,
+ MinVersion = ProtocolVersionWitnessVersion,
MinProtocolCapabilities = new ProtocolCapabilities { SupportGetBlock = true, SupportWitness = true }
};
public static readonly NodeRequirement LocalBackendNodeRequirements = new NodeRequirement
{
RequiredServices = NodeServices.NODE_WITNESS,
- MinVersion = ProtocolVersion_WITNESS_VERSION,
+ MinVersion = ProtocolVersionWitnessVersion,
MinProtocolCapabilities = new ProtocolCapabilities
{
SupportGetBlock = true,

MODIFY
WalletWasabi/Services/MempoolBehavior.cs
WalletWasabi/Services/MempoolBehavior.cs
@@ -12,7 +12,7 @@ namespace WalletWasabi.Services
{
public class MempoolBehavior : NodeBehavior
{
- private const int MAX_INV_SIZE = 50000;
+ private const int MaxInvSize = 50000;
public MempoolService MempoolService { get; }
@@ -66,9 +66,9 @@ namespace WalletWasabi.Services
private async Task ProcessGetDataAsync(Node node, GetDataPayload payload)
{
- if (payload.Inventory.Count > MAX_INV_SIZE)
+ if (payload.Inventory.Count > MaxInvSize)
{
- Logger.LogDebug<MempoolBehavior>($"Received inventory too big. {nameof(MAX_INV_SIZE)}: {MAX_INV_SIZE}, Node: {node.RemoteSocketEndpoint}");
+ Logger.LogDebug<MempoolBehavior>($"Received inventory too big. {nameof(MaxInvSize)}: {MaxInvSize}, Node: {node.RemoteSocketEndpoint}");
return;
}
@@ -105,9 +105,9 @@ namespace WalletWasabi.Services
private async Task ProcessInvAsync(Node node, InvPayload payload)
{
- if (payload.Inventory.Count > MAX_INV_SIZE)
+ if (payload.Inventory.Count > MaxInvSize)
{
- Logger.LogDebug<MempoolBehavior>($"Received inventory too big. {nameof(MAX_INV_SIZE)}: {MAX_INV_SIZE}, Node: {node.RemoteSocketEndpoint}");
+ Logger.LogDebug<MempoolBehavior>($"Received inventory too big. {nameof(MaxInvSize)}: {MaxInvSize}, Node: {node.RemoteSocketEndpoint}");
return;
}

Edit consts names