This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Previous Block's hash Timestamp Nonce Transaction Data | |
5FECEB66FFC86F38D952786C6D696C79C2DBC239DD4E91B46729D73A27FB57E9 1527990931106 525170 Block 1 | |
00000F7500C1AACC0A1316BDA465407D15A0177231929C15FCE54DE944B65742 1527990931107 70121 Block 2 | |
000001DF83C3C9BA681A89DA3D2F3D346895109E7B4E6E9767E04BA19996BE3F 1527990931107 125107 Block 33 | |
000009A057133D6F8DD724B712C31C25EF0703E87C825EACCB01122D4FF1842E 1527990931107 820089 Block 4 | |
00000D7EEE3583BA18D68990281069C76381DA9B5475EB41E872796A13FBB384 1527990931107 660226 Block 5 | |
000003AA70B03F4F25D468C8A7B13ED8483B419BB6503BE8B25CB14DCC2855F8 1527990931107 31723 Block 6 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ java HashBreaker | |
Nonce Finder | |
Message : Block 331527990931107000001DF83C3C9BA681A89DA3D2F3D346895109E7B4E6E9767E04BA19996BE3F | |
Difficulty : 5 | |
Calculating... | |
Valid Nonce : 125107 | |
Hash : 00000277418AFAF4F19430EDE51B573FAE4C3DCB13B20352A43778802DF0E12F | |
Time taken : 0.945 seconds |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class HashBreaker { | |
public static void main(String[] args) throws NoSuchAlgorithmException { | |
var scanner = new Scanner(System.in); | |
System.out.println("Nonce Finder"); | |
System.out.print("Message : "); | |
String message = scanner.nextLine(); | |
System.out.print("Difficulty : "); | |
int d = scanner.nextInt(); | |
System.out.println("\nCalculating..."); | |
long startTime = System.currentTimeMillis(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Block 331527990931107000001DF83C3C9BA681A89DA3D2F3D346895109E7B4E6E9767E04BA19996BE3F3632550 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Block 331527990931107000001DF83C3C9BA681A89DA3D2F3D346895109E7B4E6E9767E04BA19996BE3F3632550 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public String getHash() throws NoSuchAlgorithmException { | |
return CryptoHelper.sha256(transactionData + String.valueOf(timestamp) | |
+ String.valueOf(previousBlockHash) | |
+ String.valueOf(nonce)); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Previous Block's hash Timestamp Nonce Transaction Data | |
5FECEB66FFC86F38D952786C6D696C79C2DBC239DD4E91B46729D73A27FB57E9 1527990931106 0525170 Block 1 | |
00000F7500C1AACC0A1316BDA465407D15A0177231929C15FCE54DE944B65742 1527990931107 0070121 Block 2 | |
000001DF83C3C9BA681A89DA3D2F3D346895109E7B4E6E9767E04BA19996BE3F 1527990931107 3632550 Block 3 | |
000009A057133D6F8DD724B712C31C25EF0703E87C825EACCB01122D4FF1842E 1527990931107 0820089 Block 4 | |
00000D7EEE3583BA18D68990281069C76381DA9B5475EB41E872796A13FBB384 1527990931107 0660226 Block 5 | |
000003AA70B03F4F25D468C8A7B13ED8483B419BB6503BE8B25CB14DCC2855F8 1527990931107 0031723 Block 6 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
app.UseSignalR(routes => { routes.MapHub("/graphHub"); }); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using Microsoft.AspNetCore.SignalR; | |
using System.Threading.Tasks; | |
namespace SignalR_LiveGraph | |
{ | |
public class GraphHub : Hub | |
{ | |
public Task SendValue(int value) | |
{ | |
return Clients.All.SendAsync("ReceiveValue", value); | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public void Configure(IApplicationBuilder app, IHostingEnvironment env) | |
{ | |
if (env.IsDevelopment()) | |
{ | |
app.UseDeveloperExceptionPage(); | |
} | |
app.UseFileServer(); // <--- Add this | |
} |