Skip to content

Commit 1fad6f9

Browse files
authored
Merge pull request #3 from cschuchardt88/version
Fixed version
2 parents b128e74 + 850b86b commit 1fad6f9

File tree

7 files changed

+456
-453
lines changed

7 files changed

+456
-453
lines changed

src/Neo.FileStorage.API/Neo.FileStorage.API.csproj

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
2020
<Company>The Neo Project</Company>
2121
<GenerateDocumentationFile>true</GenerateDocumentationFile>
22-
<VersionPrefix>3.7.5</VersionPrefix>
22+
<VersionPrefix>3.8.1</VersionPrefix>
2323
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
2424
<WarningLevel>4</WarningLevel>
2525
<AnalysisLevel>latest</AnalysisLevel>
@@ -52,17 +52,14 @@
5252
</ItemGroup>
5353

5454
<ItemGroup>
55-
<PackageReference Include="Google.Protobuf" Version="3.29.3" />
56-
<PackageReference Include="Grpc.Net.Client" Version="2.67.0" />
57-
<PackageReference Include="Grpc.AspNetCore" Version="2.67.0" />
58-
<PackageReference Include="Grpc.Tools" Version="2.69.0">
59-
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
60-
<PrivateAssets>all</PrivateAssets>
61-
</PackageReference>
62-
<PackageReference Include="BouncyCastle.NetCore" Version="2.2.1" />
63-
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
64-
<PackageReference Include="Sprache" Version="2.3.1" />
65-
<PackageReference Include="System.Text.RegularExpressions" Version="4.3.1" />
55+
<PackageReference Include="Google.Protobuf" Version="3.32.1" />
56+
<PackageReference Include="Grpc.Net.Client" Version="2.71.0" />
57+
<PackageReference Include="Grpc.AspNetCore" Version="2.71.0" />
58+
<PackageReference Include="Grpc.Tools" Version="2.72.0" PrivateAssets="all" />
59+
<PackageReference Include="BouncyCastle.Cryptography" Version="2.6.*" />
60+
<PackageReference Include="Newtonsoft.Json" Version="13.0.*" />
61+
<PackageReference Include="Sprache" Version="2.3.*" />
62+
<PackageReference Include="System.Text.RegularExpressions" Version="4.3.*" />
6663
</ItemGroup>
6764

68-
</Project>
65+
</Project>

src/Neo.FileStorage.API/cryptography/Helper.cs

Lines changed: 82 additions & 81 deletions
Original file line numberDiff line numberDiff line change
@@ -17,100 +17,101 @@
1717
using System.Buffers.Binary;
1818
using System.Security.Cryptography;
1919

20-
namespace Neo.FileStorage.API.Cryptography;
21-
22-
public static class Helper
20+
namespace Neo.FileStorage.API.Cryptography
2321
{
24-
public const int Sha256HashLength = 32;
25-
26-
internal static byte[] RIPEMD160(this byte[] value)
27-
{
28-
var hash = new byte[20];
29-
var digest = new RipeMD160Digest();
30-
digest.BlockUpdate(value, 0, value.Length);
31-
digest.DoFinal(hash, 0);
32-
return hash;
33-
}
34-
35-
public static byte[] Sha256(this byte[] value)
36-
{
37-
using var sha256 = SHA256.Create();
38-
return sha256.ComputeHash(value);
39-
}
40-
41-
internal static byte[] Sha256(this byte[] value, int offset, int count)
42-
{
43-
using var sha256 = SHA256.Create();
44-
return sha256.ComputeHash(value, offset, count);
45-
}
46-
47-
internal static byte[] Sha256(this ReadOnlySpan<byte> value)
22+
public static class Helper
4823
{
49-
var buffer = new byte[32];
50-
using var sha256 = SHA256.Create();
51-
sha256.TryComputeHash(value, buffer, out _);
52-
return buffer;
53-
}
54-
55-
public static ByteString Sha256(this IMessage data)
56-
{
57-
return ByteString.CopyFrom(data.ToByteArray().Sha256());
58-
}
24+
public const int Sha256HashLength = 32;
5925

60-
public static ByteString Sha256(this ByteString data)
61-
{
62-
return ByteString.CopyFrom(data.ToByteArray().Sha256());
63-
}
26+
internal static byte[] RIPEMD160(this byte[] value)
27+
{
28+
var hash = new byte[20];
29+
var digest = new RipeMD160Digest();
30+
digest.BlockUpdate(value, 0, value.Length);
31+
digest.DoFinal(hash, 0);
32+
return hash;
33+
}
34+
35+
public static byte[] Sha256(this byte[] value)
36+
{
37+
using var sha256 = SHA256.Create();
38+
return sha256.ComputeHash(value);
39+
}
6440

65-
public static Checksum Sha256Checksum(this IMessage data)
66-
{
67-
return new Checksum
41+
internal static byte[] Sha256(this byte[] value, int offset, int count)
6842
{
69-
Type = ChecksumType.Sha256,
70-
Sum = data.Sha256()
71-
};
72-
}
43+
using var sha256 = SHA256.Create();
44+
return sha256.ComputeHash(value, offset, count);
45+
}
7346

74-
public static Checksum Sha256Checksum(this ByteString data)
75-
{
76-
return new Checksum
47+
internal static byte[] Sha256(this ReadOnlySpan<byte> value)
7748
{
78-
Type = ChecksumType.Sha256,
79-
Sum = data.Sha256()
80-
};
81-
}
49+
var buffer = new byte[32];
50+
using var sha256 = SHA256.Create();
51+
sha256.TryComputeHash(value, buffer, out _);
52+
return buffer;
53+
}
8254

83-
public static ByteString TzHash(this IMessage data)
84-
{
85-
return ByteString.CopyFrom(new TzHash().ComputeHash(data.ToByteArray()));
86-
}
55+
public static ByteString Sha256(this IMessage data)
56+
{
57+
return ByteString.CopyFrom(data.ToByteArray().Sha256());
58+
}
8759

88-
public static ByteString TzHash(this ByteString data)
89-
{
90-
return ByteString.CopyFrom(new TzHash().ComputeHash(data.ToByteArray()));
91-
}
60+
public static ByteString Sha256(this ByteString data)
61+
{
62+
return ByteString.CopyFrom(data.ToByteArray().Sha256());
63+
}
9264

93-
public static Checksum TzChecksum(this IMessage data)
94-
{
95-
return new Checksum
65+
public static Checksum Sha256Checksum(this IMessage data)
9666
{
97-
Type = ChecksumType.Sha256,
98-
Sum = data.TzHash()
99-
};
100-
}
67+
return new Checksum
68+
{
69+
Type = ChecksumType.Sha256,
70+
Sum = data.Sha256()
71+
};
72+
}
73+
74+
public static Checksum Sha256Checksum(this ByteString data)
75+
{
76+
return new Checksum
77+
{
78+
Type = ChecksumType.Sha256,
79+
Sum = data.Sha256()
80+
};
81+
}
82+
83+
public static ByteString TzHash(this IMessage data)
84+
{
85+
return ByteString.CopyFrom(new TzHash().ComputeHash(data.ToByteArray()));
86+
}
10187

102-
public static Checksum TzChecksum(this ByteString data)
103-
{
104-
return new Checksum
88+
public static ByteString TzHash(this ByteString data)
10589
{
106-
Type = ChecksumType.Sha256,
107-
Sum = data.TzHash()
108-
};
109-
}
90+
return ByteString.CopyFrom(new TzHash().ComputeHash(data.ToByteArray()));
91+
}
11092

111-
public static ulong Murmur64(this byte[] value, uint seed)
112-
{
113-
using var murmur = new Murmur3_128(seed);
114-
return BinaryPrimitives.ReadUInt64LittleEndian(murmur.ComputeHash(value));
93+
public static Checksum TzChecksum(this IMessage data)
94+
{
95+
return new Checksum
96+
{
97+
Type = ChecksumType.Sha256,
98+
Sum = data.TzHash()
99+
};
100+
}
101+
102+
public static Checksum TzChecksum(this ByteString data)
103+
{
104+
return new Checksum
105+
{
106+
Type = ChecksumType.Sha256,
107+
Sum = data.TzHash()
108+
};
109+
}
110+
111+
public static ulong Murmur64(this byte[] value, uint seed)
112+
{
113+
using var murmur = new Murmur3_128(seed);
114+
return BinaryPrimitives.ReadUInt64LittleEndian(murmur.ComputeHash(value));
115+
}
115116
}
116117
}

0 commit comments

Comments
 (0)