Bitcoin Forum
April 22, 2026, 01:16:23 AM *
News: Latest Bitcoin Core release: 30.2 [Torrent]
 
   Home   Help Search Login Register More  
Pages: « 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 [43] 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 ... 98 »
  Print  
Author Topic: BitCrack - A tool for brute-forcing private keys  (Read 79978 times)
renedx
Jr. Member
*
Offline Offline

Activity: 36
Merit: 3


View Profile
March 22, 2021, 05:13:16 PM
Merited by NotATether (1)
 #841

Only way you’ll see me party a pool with my GPUs is when NotATether is the only, verified, owner. Based of the open and honesty he shares in the findings and improving CUDA, it’s a no-brainer he’s here to improve everyone.

Regarding the sp-mod, your V2 link has a Trojan in it per Win10 findings (conteban).
Your V1 doesn’t run on ampere. 3060, 3070, 3080 or 3090.

Nevertheless nice to see some activity on it again  Grin
Very curious what the fix would be.
NotATether
Legendary
*
Offline Offline

Activity: 2310
Merit: 9631


┻┻ ︵㇏(°□°㇏)


View Profile WWW
March 22, 2021, 05:23:35 PM
Last edit: March 22, 2021, 05:35:04 PM by NotATether
 #842

Can you please explain this ? Suppose i got all 2^n and 2^n*G till required N. Lets take it as 30 for now. In that case if i have to find k*G derived from K 700000003 which is between 2^29 and 2^30 , how would i , since i dont know K value. It will require me to go through all K. Ofcourse it will be easier using point additions and i think this is what existing libraries like secp259k1 do but this wont help in case of looking up thousands of pubkeys at once.

I didn't get your point of jump tables and point lookup in hashtable using factor as index thing. Sounds interesting though.

In binary notation we make arbitrary decimal numbers from powers of two like this:

00000110

represents 6, or 4+2, in binary.

With a list of 2^n*G points, to make 6G you'd just compute 2G+4G which is fast since you already have those factors.

To make any arbitrary point from a factor, you take the lowest bit and see if that's equal to one and not zero. That means you have to add "1G". Then you right shift the entire number, for example into this:

00000011

Then see if the lowest bit is one again, this time it means there is a 2G term you have to add.

Repeat the process to check if you have to add 4G, 8G and so on and you can make any arbitrary point in log2(n) time.

Only way you’ll see me party a pool with my GPUs is when NotATether is the only, verified, owner. Based of the open and honesty he shares in the findings and improving CUDA, it’s a no-brainer he’s here to improve everyone.

Thank you for the kind words. But I think I'd have an easier time operating a pool if other people were involved, even I have to sleep too you know Tongue

Regarding the sp-mod, your V2 link has a Trojan in it per Win10 findings (conteban).
Your V1 doesn’t run on ampere. 3060, 3070, 3080 or 3090.

I don't think it has malware. Anti-viruses are known to make bullshit false flags on crypto software and miners in particular (which we'll inevitably see happening if Stratum urls and networking are added). Besides, the sp-mod commit history is on Github so if he really were up to something shady then we'd already see it by now.

*Shit there is only a README file in the repository, the source code is available as an asset on the releases page, but I have to get on desktop to read it.

 
 b1exch.to 
  ETH      DAI   
  BTC      LTC   
  USDT     XMR    
.███████████▄▀▄▀
█████████▄█▄▀
███████████
███████▄█▀
█▀█
▄▄▀░░██▄▄
▄▀██▄▀█████▄
██▄▀░▄██████
███████░█████
█░████░█████████
█░█░█░████░█████
█░█░█░██░█████
▀▀▀▄█▄████▀▀▀
renedx
Jr. Member
*
Offline Offline

Activity: 36
Merit: 3


View Profile
March 22, 2021, 05:29:38 PM
 #843


Regarding the sp-mod, your V2 link has a Trojan in it per Win10 findings (conteban).
Your V1 doesn’t run on ampere. 3060, 3070, 3080 or 3090.

I don't think it has malware. Anti-viruses are known to make bullshit false flags on crypto software and miners in particular (which we'll inevitably see happening if Stratum urls and networking are added). Besides, the sp-mod commit history is on Github so if he really were up to something shady then we'd already see it by now.

Oh wasn't ment like that, I just wanted to share some people cannot open the file in the first place. I just did some quick test.
I couldn't find the commit history sadly enough? The files are empty, for me at least.
Was searching for it, to see how / what he changed. We're talking about this repo, right? https://github.com/sp-hash/Bitcrack
sp_
Legendary
*
Offline Offline

Activity: 2996
Merit: 1089

Team Black developer


View Profile
March 22, 2021, 08:03:42 PM
Last edit: March 22, 2021, 08:20:15 PM by sp_
 #844

No viruses found in my bitcrack exe files.

#1
https://www.virustotal.com/gui/file/a14fe7162c8a649470325fbaffbc1647e97be3b3084a4127165a923149f18dd5/detection

#2
https://www.virustotal.com/gui/file/8fff68b00a45289b5b4493ffaa3e5d4bbefb646ca19c2eb9e4b4e3c4e2f6a765/detection

I have sent you the file to test, but nobody has reported the speed yet. #2 Should work on the gtx 750ti from 2014 and newer nvidia gpu's

Some pascal results (compressed):

gtx 1050: 50 Mkey (laptop?)
gtx 1070: 370 MKey
gtx 1070ti: 404Mkey
gtx 1080ti: 600Mkey
Titanx pascal: 560Mkey


The original bitcrack does 9.4 Mkey on the (GeForce GT 640) . So the 1080ti with the sp-mod #2 is 63 times faster.

Team Black Miner (ETHB3 ETH ETC VTC KAWPOW QUAI-KAWPOW FIROPOW EVRPROGPOW MEOWPOW + dual mining.. https://github.com/sp-hash/TeamBlackMiner
WanderingPhilospher
Sr. Member
****
Offline Offline

Activity: 1498
Merit: 286

Shooters Shoot...


View Profile
March 22, 2021, 09:44:49 PM
 #845

Quote
The original bitcrack does 9.4 Mkey on the (GeForce GT 640) . So the 1080ti with the sp-mod #2 is 63 times faster.
If the original bitcrack did 9.4 MKey/s on the GT 640, does that mean your mod will do 100000000000 MKey/s on the 3070?
Seemed like you were comparing the speed of a 640 against a 1080Ti...
A-Bolt
Legendary
*
Offline Offline

Activity: 2376
Merit: 2534


View Profile
March 22, 2021, 11:19:48 PM
 #846

and for puzzle # 120-#160 how can I change it to can use with puzzle #160
Okay, but it looks pointless for me.
This code is for arbitrary puzzle output number (n):
Code:
const Int32 n = 120;  // Output number of the puzzle tx

Byte[] rnd256 = new Byte[32];
var random = new Random();
random.NextBytes(rnd256); // Get 256-bit random sequence 

Int32 nBytes = (n - 1) / 8;
Int32 nBits = (n - 1) % 8;
Byte mask = (Byte)(0xFF >> (8 - nBits));

for (UInt32 i = 0; i < 32 - nBytes - 1; i++) rnd256[i] = 0; // Zeroing unused bytes
rnd256[32 - nBytes - 1] &= mask;                            // Zeroing unused bits                     
rnd256[32 - nBytes - 1] |= (Byte)(mask + 1);                // Most significant bit is always 1.

String rndHex = BitConverter.ToString(rnd256).Replace("-", String.Empty);

Console.WriteLine(rndHex);
renedx
Jr. Member
*
Offline Offline

Activity: 36
Merit: 3


View Profile
March 23, 2021, 12:11:12 AM
Last edit: March 23, 2021, 12:23:58 AM by renedx
 #847

No viruses found in my bitcrack exe files.

#1
https://www.virustotal.com/gui/file/a14fe7162c8a649470325fbaffbc1647e97be3b3084a4127165a923149f18dd5/detection

#2
https://www.virustotal.com/gui/file/8fff68b00a45289b5b4493ffaa3e5d4bbefb646ca19c2eb9e4b4e3c4e2f6a765/detection

I have sent you the file to test, but nobody has reported the speed yet. #2 Should work on the gtx 750ti from 2014 and newer nvidia gpu's

Some pascal results (compressed):

gtx 1050: 50 Mkey (laptop?)
gtx 1070: 370 MKey
gtx 1070ti: 404Mkey
gtx 1080ti: 600Mkey
Titanx pascal: 560Mkey


The original bitcrack does 9.4 Mkey on the (GeForce GT 640) . So the 1080ti with the sp-mod #2 is 63 times faster.

Will test.

3090:
Quote

Bitcrack sp-mod #2 (https://github.com/sp-hash)


[2021-03-23.01:06:51] [Info] Compression: compressed
[2021-03-23.01:06:51] [Info] Starting at: 0000000000000000000000000000000000000000000000000000000000000001
[2021-03-23.01:06:51] [Info] Ending at:   FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364140
[2021-03-23.01:06:51] [Info] Counting by: 0000000000000000000000000000000000000000000000000000000000000001
[2021-03-23.01:06:51] [Info] Initializing GeForce RTX 3090
[2021-03-23.01:07:02] [Info] Generating 171,966,464 starting points (1640.0MB)
[2021-03-23.01:07:26] [Info] 10.0%
[2021-03-23.01:07:27] [Info] 20.0%
[2021-03-23.01:07:27] [Info] 30.0%
[2021-03-23.01:07:27] [Info] 40.0%
[2021-03-23.01:07:28] [Info] 50.0%
[2021-03-23.01:07:28] [Info] 60.0%
[2021-03-23.01:07:28] [Info] 70.0%
[2021-03-23.01:07:29] [Info] 80.0%
[2021-03-23.01:07:29] [Info] 90.0%
[2021-03-23.01:07:30] [Info] 100.0%
[2021-03-23.01:07:30] [Info] Done

Quote

Bitcrack sp-mod #2 (https://github.com/sp-hash)


[2021-03-23.01:10:01] [Info] Compression: compressed
[2021-03-23.01:10:01] [Info] Starting at: 0000000000000000000000000000000000000000000000000000000000000001
[2021-03-23.01:10:01] [Info] Ending at:   FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364140
[2021-03-23.01:10:01] [Info] Counting by: 0000000000000000000000000000000000000000000000000000000000000001
[2021-03-23.01:10:01] [Info] Initializing GeForce RTX 3090
[2021-03-23.01:10:01] [Info] Generating 171,966,464 starting points (1640.0MB)
[2021-03-23.01:10:27] [Info] 10.0%
[2021-03-23.01:10:28] [Info] 20.0%
[2021-03-23.01:10:28] [Info] 30.0%
[2021-03-23.01:10:29] [Info] 40.0%
[2021-03-23.01:10:29] [Info] 50.0%
[2021-03-23.01:10:29] [Info] 60.0%
[2021-03-23.01:10:30] [Info] 70.0%
[2021-03-23.01:10:30] [Info] 80.0%
[2021-03-23.01:10:31] [Info] 90.0%
[2021-03-23.01:10:31] [Info] 100.0%
[2021-03-23.01:10:31] [Info] Done
[2021-03-23.01:10:32] [Info] Error: misaligned address
Execution time = 31 seconds

Same problem,  it sometimes throws error, sometimes stays stuck on Done depends on the ampere mood.  Grin

Quote
The original bitcrack does 9.4 Mkey on the (GeForce GT 640) . So the 1080ti with the sp-mod #2 is 63 times faster.
If the original bitcrack did 9.4 MKey/s on the GT 640, does that mean your mod will do 100000000000 MKey/s on the 3070?
Seemed like you were comparing the speed of a 640 against a 1080Ti...

Even if he is able to 2x the openCL speed on the Ampere cards, it would take my spare -/+20 cards 74 days to crack 10% of the puzzle 64. Could be enough, but prob. still would take a lot of time.

Btw _sp
I can remote access you a RTX card if it helps.
fxsniper
Member
**
Offline Offline

Activity: 406
Merit: 47


View Profile
March 23, 2021, 01:32:06 AM
 #848

Kaspersky scan not found virus is ok

but if download from google chrome may be get warning about download from internet and recommend to delete out

try download from opera or other browser
fxsniper
Member
**
Offline Offline

Activity: 406
Merit: 47


View Profile
March 23, 2021, 01:35:29 AM
 #849

Quote
The original bitcrack does 9.4 Mkey on the (GeForce GT 640) . So the 1080ti with the sp-mod #2 is 63 times faster.
If the original bitcrack did 9.4 MKey/s on the GT 640, does that mean your mod will do 100000000000 MKey/s on the 3070?
Seemed like you were comparing the speed of a 640 against a 1080Ti...

How can use GeForce GT 640 with CUDA please advice ?

I use GeForce GT 720 but can not use CUDA
my GeForce GT 720 can use only OpenCL
if can use CUDA may be better faster
WanderingPhilospher
Sr. Member
****
Offline Offline

Activity: 1498
Merit: 286

Shooters Shoot...


View Profile
March 23, 2021, 01:38:22 AM
 #850

Quote
Even if he is able to 2x the openCL speed on the Ampere cards, it would take my spare -/+20 cards 74 days to crack 10% of the puzzle 64. Could be enough, but prob. still would take a lot of time.

Btw _sp
I can remote access you a RTX card if it helps

Ha...ha...ha...unless I am reading what you are saying wrong.  You have 20 cards, round about 20? And you think you would crack 10%?  The pool has been running pretty non stop for over a year. With Zielar's big push at times with 256 to 512 V100, and they are barely above 10%.  Yes. 256 up to 512 V100s at times...over a year running, and barely above 10%.
NotATether
Legendary
*
Offline Offline

Activity: 2310
Merit: 9631


┻┻ ︵㇏(°□°㇏)


View Profile WWW
March 23, 2021, 04:25:42 AM
 #851

but if download from google chrome may be get warning about download from internet and recommend to delete out

Chrome on Windows does that for all exe files that aren't signed. I haven't seen this behavior on Mac or Linux, probably because on Windows the browser assumes that you're downloading a virus.



I wanted to run the spmod2 Bitcrack on my T4, on Linux, but there is no source code to compile from.

Linux cracking speed has the potential to be much faster than Windows because there's no GUI that's using GPU cycles.

 
 b1exch.to 
  ETH      DAI   
  BTC      LTC   
  USDT     XMR    
.███████████▄▀▄▀
█████████▄█▄▀
███████████
███████▄█▀
█▀█
▄▄▀░░██▄▄
▄▀██▄▀█████▄
██▄▀░▄██████
███████░█████
█░████░█████████
█░█░█░████░█████
█░█░█░██░█████
▀▀▀▄█▄████▀▀▀
chrysophylax
Legendary
*
Offline Offline

Activity: 3150
Merit: 1093


--- ChainWorks Industries ---


View Profile WWW
March 23, 2021, 04:28:33 AM
 #852

Seems like I missed quite a discussion going on here  Roll Eyes

Each of the GPUs are only going to get $8.02 assuming (ridiculously) that all cards have the same key rate. The fact that they don't means that even the fastest cards can only really expect to get $12 out of #64 (unless you're the pool owner where you get a generous 1% commission) and that's why I think that stratum wasn't added to Bitcrack earlier.

The miner get payed by how many keys he finds. Remember we search all the keys in a given interval. A 1000 gpu farm will find more keys than a single gpu. The miningpool will have Double key protection. When a privatekey is found, the reward is split between the miners based on the valid keycount in the interval. Every key is not sent to the pool, so the keycount will be estimated according to the difficulty and valid shares.

Yeah I didn't mean to imply that everyone's going to be paying a fixed reward, people are actually less likely to mine [keys? I like that phrase  Grin] at pools that'll only give them a fixed amount of money.

And a solid OpenCL needs to be developed. Brichard19 has the knowledge; I've used his Kangaroo program using OpenCL and it is the only program out there that fully utilizes the power of the newer cards plus all the old cards and AMD cards.

One of my wild fantasies is to learn OpenCL to make a version of the Kangaroo Int class that runs on AMD cards. Sadly for now it remains a fantasy as I got my hands tied with what I'm now going to call "Kangaroo-256", and I'm already learning CUDA the hard way - through trial and error. I don't expect OpenCL to be any different.

Before this I didn't think Telariust VanitySearch-Bitcrack combo was legit, or at the very least I thought it was some rudimentary mishmash whose sum was less than the parts. Nice to know I have something else to open up my eyes to as well.

Also - be VERY careful with those that purport to be doing this as a 'showing of muscles' in the development department, especially those with a history of ripping people off in the past. All it takes is a component of code in the 'private/compiled' software that is currently being distributed to report back and alert immediately to the creator of that 'Private' code so that he moves all funds for himself.

Definitely not me that's for sure. I know this is not an accusation at me obviously Wink

Actually y'all can take a stab at what I'm working on at https://gitea.datahoarding.agency/ZenulAbidin/Kangaroo-256 on my own git server and not on github cause this is still alpha and I didn't feel like pushing broken code to Github.

This'll eventually hit github when it's completely finished.

I have some other commits beyond this at local particularly on the GPU side of things but I'm not quite done with them yet (there is a nasty segfault I have to debug).

I think it's a step in the right direction.




No - not a crack at you at all ...

You at least supply Source in Git.

I am directing almost all of that at sp_ (a guy by the name of Rune Stensland) who always crawls out from under his stone when he thinks that people have forgotten or otherwise are busy with other things, where he comes out with a 'Private' coded app and either sells it, gives it away for later purchases, or just plain codes it to benefit himself. He has no interest whatsoever in 'helping' otherwise the coding would all be done in Git and supplied as opensource. ALWAYS watch out for this guy - he has ALWAYS been shifty character and ALWAYS made money off PEOPLE, not his work. Especially in the days of Algo Optimization where my friend (and at the time work colleague for us at CWI) Alexis )known as Alexis78) showed Rune what it was to REALLY code Algo's and optimize them. Also releasing most of the code as OpenSource - which almost ALL of the CUDA GPU miners are based on today.

Alexis and I are STILL friends, STILL work together on certain projects, and STILL despise what Rune is consistently doing every few months or so.

So be careful of this guy Rune / sp_ as he is NOT for the community and ONLY for himself. You have all been warned!

As for the app you are writing - we can most certainly discuss and work together for a MUCH improved version as well as a verifiable Community edition package, unlike those of which Rune is pushing.

#crysx

chrysophylax
Legendary
*
Offline Offline

Activity: 3150
Merit: 1093


--- ChainWorks Industries ---


View Profile WWW
March 23, 2021, 04:41:52 AM
 #853

but if download from google chrome may be get warning about download from internet and recommend to delete out

Chrome on Windows does that for all exe files that aren't signed. I haven't seen this behavior on Mac or Linux, probably because on Windows the browser assumes that you're downloading a virus.



I wanted to run the spmod2 Bitcrack on my T4, on Linux, but there is no source code to compile from.

Linux cracking speed has the potential to be much faster than Windows because there's no GUI that's using GPU cycles.

Hence my warning ...

Rune (sp_) is not about the commmunity like you are, he is about himself.

#crysx

chrysophylax
Legendary
*
Offline Offline

Activity: 3150
Merit: 1093


--- ChainWorks Industries ---


View Profile WWW
March 23, 2021, 04:44:47 AM
 #854

Quote
Till then, is there any Pool Software at all that could be setup for complete transaprency of what is being done?
Easy to setup, open source

https://github.com/Etayson/BC_server-client

Even has checks and balances of "fake" shares/submits by creating a key in each range that is checked/verified. Same as other pool.

Quote
There are ways to increase the compute power by levels of magnitude, and I know what some of those are, but need the coders to do the coding to bring these things to life.
Interested in ideas...always.





Thanks ...

Will have a look at this over the coming week.

As for connection - Skype is the best way to get me. Alternately, the CWI Discord Server in the Details Page of the Main CWI BCTThread in my Sig.

Skype - chrysophylax69

#crysx

Oh No ...

Is this 'pool' Windows based only?

Is there a linux based version, as we mainly use CentOS7 CentOS8 for our servers, which we would gladly setup for the community.

Windows is a no go for us at CWI. Never will be. EVER.

#crysx

WanderingPhilospher
Sr. Member
****
Offline Offline

Activity: 1498
Merit: 286

Shooters Shoot...


View Profile
March 23, 2021, 05:09:59 AM
 #855

Quote
Oh No ...

Is this 'pool' Windows based only?

I'm not sure. I know Etar used windows, but don't know if you can compile in Linux. Man was a coding genius, could put something together that he or someone needed fairly quickly, all in PureBasic.

Maybe you or one of your 'coders' can look at the code and build something for Linux. If I had the know how, I would have set up BSGS pool long ago. Zero experience with network, sockets, etc.
fxsniper
Member
**
Offline Offline

Activity: 406
Merit: 47


View Profile
March 23, 2021, 07:53:13 AM
 #856


Oh No ...

Is this 'pool' Windows based only?

Is there a linux based version, as we mainly use CentOS7 CentOS8 for our servers, which we would gladly setup for the community.

Windows is a no go for us at CWI. Never will be. EVER.

#crysx


64 bit pool  have support both windows and Linux ( Ubuntu 64 bit 14.04.2 LTS and 18.04.3 LTS.)

support only bitcrack  no BSGS
fxsniper
Member
**
Offline Offline

Activity: 406
Merit: 47


View Profile
March 23, 2021, 08:40:08 AM
 #857


gtx 1050: 50 Mkey (laptop?)
 

yes laptop

I not have PC desktop
fxsniper
Member
**
Offline Offline

Activity: 406
Merit: 47


View Profile
March 23, 2021, 09:17:50 AM
 #858


Why Kangaroo high than bitcrack?

my bitcrack on GTX 1050 (laptop)

cuBitCrack  normal 11 MKey
cuBitCrack  modify1 50 MKey
cuBitCrack  modify2 30 MKey
and
Kangaroo with gpu 100Mkey

That mean max cuBitCrack can do only 50 MKey
cuBitCrack complete calculate have multiple step to convert from private key to address make it slow right
and
Kangaroo do short calculate from private key to public key is less step more that bitcrack make it count Mkey higher correct?

if not how possible make bitcrack high power like Kangaroo (gpu) up to 100Mkey

Kangaroo show
SolveKeyGPU Thread GPU#0: 2^18.32 kangaroos [4.2s]
[127.82 MK/s][GPU 107.38 MK/s][Count 2^36.52][Dead 0][18:31 (Avg 76.1711y)][2.0/4.0MB]
fxsniper
Member
**
Offline Offline

Activity: 406
Merit: 47


View Profile
March 23, 2021, 09:46:14 AM
 #859

Quote
Really? ...

Do you have the links to the faster ones?

The groundwork was laid a long time ago.

https://github.com/Telariust/VanitySearch-bitcrack

Faster, with multi gpu support. Take existing code and make the tweaks one wants/needs. Much easier to understand and tweak vs bitcrack, IMO. Pool operator can verify that it is faster as well. It also supports the newer cards, 30xx series.

yes, it faster


my test
VanitySearch is faster

I am not sure can compare or not with method search for bitcrack and vanitysearch


brichard19 BitCrack ==> 11 MK/s

Bitcrack-sp-mod1 ==> 50 MK/s  (full memory)
Bitcrack-spmod2 ==> 50 MK/s

VanitySearch-bitcrack ==> 70 MK/s

VanitySearch ==> 149 MK/s

command test
VanitySearch.exe -gpu 16jY7qLJnxb7CHZyqBP8qca9d51gAjyXQN


VanitySearch-bitcrack
GPU: GPU #0 GeForce GTX 1050 (5x128 cores) Grid(40x512)
80.121 MK/s (GPU 70.098 MK/s) (2^29.91) [00:00:12 lost_TIME_left infinity][0]

VanitySearch
GPU: GPU #0 GeForce GTX 1050 (5x128 cores) Grid(40x128)
[169.91 Mkey/s][GPU 149.29 Mkey/s][Total 2^29.95][Prob 0.0%][50% in 1.89065e+32y][Found 0]


problem
VanitySearch fast but it search full key 265bits
can not search by keyspace for puzzle #64
fxsniper
Member
**
Offline Offline

Activity: 406
Merit: 47


View Profile
March 23, 2021, 10:01:10 AM
 #860

and for puzzle # 120-#160 how can I change it to can use with puzzle #160
Okay, but it looks pointless for me.
This code is for arbitrary puzzle output number (n):
Code:
const Int32 n = 120;  // Output number of the puzzle tx

Byte[] rnd256 = new Byte[32];
var random = new Random();
random.NextBytes(rnd256); // Get 256-bit random sequence 

Int32 nBytes = (n - 1) / 8;
Int32 nBits = (n - 1) % 8;
Byte mask = (Byte)(0xFF >> (8 - nBits));

for (UInt32 i = 0; i < 32 - nBytes - 1; i++) rnd256[i] = 0; // Zeroing unused bytes
rnd256[32 - nBytes - 1] &= mask;                            // Zeroing unused bits                     
rnd256[32 - nBytes - 1] |= (Byte)(mask + 1);                // Most significant bit is always 1.

String rndHex = BitConverter.ToString(rnd256).Replace("-", String.Empty);

Console.WriteLine(rndHex);

Thank you A-Bolt

Just hobby do after works or free time (Only during this time interest not yet give up)
Pages: « 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 [43] 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 ... 98 »
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!