Skip to content

Instantly share code, notes, and snippets.

@rvrsh3ll
Last active January 7, 2024 16:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rvrsh3ll/c3ad6e200071be0e413a916db4f76c99 to your computer and use it in GitHub Desktop.
Save rvrsh3ll/c3ad6e200071be0e413a916db4f76c99 to your computer and use it in GitHub Desktop.
Function Calculate-BitcoinKeySpaceBrute() {
<#
.SYNOPSIS
Calculate the number of days to brute force a keyspace with BitCrack given an amount of keys per second "mkeys".
May be used to calculate time to crack bitcoin puzzle 32 https://privatekeys.pw/puzzles/bitcoin-puzzle-tx
Bitcrack: https://github.com/brichard19/BitCrack
Author: Steve Borosh (@rvrsh3ll)
License: BSD 3-Clause
Required Dependencies: None
Optional Dependencies: None
.DESCRIPTION
Calculate the number of days to brute force a keyspace with BitCrack given an amount of keys per second "mkeys".
.PARAMETER startingexponent
Starting keyspace
.PARAMETER endingexponent
Ending keyspace
.PARAMETER mkeys
Millions of keys per second
.PARAMETER shares
Number of shares keyspace is split into
.EXAMPLE
Calculate-KeySpaceBrute -startingexponent 17 -endingexponent 18 -mkeys 185 -shares 200
#>
[CmdletBinding()]
Param (
[Parameter(Mandatory = $false)]
[int]
$startingexponent,
[Parameter(Mandatory = $false)]
[int]
$endingexponent,
[Parameter(Mandatory = $false)]
[int]
$mkeys,
[Parameter(Mandatory = $false)]
[int]
$shares
)
$mkeys = ($mkeys * 1000000)
$startingKeyspace = [Math]::Pow(2,$startingexponent)
Write-Host "Start Keyspace " $startingKeyspace
$endingKeyspace = [Math]::Pow(2,$endingexponent)
Write-Host "Ending Keyspace " $endingkeyspace
$total = ($endingKeyspace - $startingKeyspace)
Write-Host "Total Keyspace" $total
if ($shares) {
$totalSplit = ($total/$shares)
}
else {
$totalSplit = $total
}
$seconds = $totalSplit/$mkeys
Write-Host "Seconds to complete specified share " $seconds
$minutes = ($seconds/60)
Write-Host "Minutes to complete specified share " $minutes
$hours = ($minutes/60)
Write-Host "Hours to complete specified share " $hours
$days = ($hours/24)
Write-Host "Days to complete specified share " $days
}
@Zerox456
Copy link

Zerox456 commented Jan 7, 2024

Tested but got errors:
./Calculate-BitcoinKeySpaceBrute -startingexponent 40000000000000000 -endingexponent 7ffffffffffffffff -mkeys 60 -shares 1
Errors:
./Calculate-BitcoinKeySpaceBrute: line 1: syntax error near unexpected token `('

./Calculate-BitcoinKeySpaceBrute: line 1: `Function Calculate-BitcoinKeySpaceBrute() {'

@rvrsh3ll
Copy link
Author

rvrsh3ll commented Jan 7, 2024

Here ya go!

calcspace

@Zerox456
Copy link

Zerox456 commented Jan 7, 2024

Thanks for response!
I'm on Ubuntu. Extract the file and chmod the file 'Calculate-BitcoinKeySpaceBrute'.
Try as you do but got the same error.
Your first command Import-Module... is return: command not found.
Normally that's because you are using windows.
Any ideas?

@rvrsh3ll
Copy link
Author

rvrsh3ll commented Jan 7, 2024

This is a PowerShell script. Either use it on Windows or install PowerShell for Linux. On your own now!

@Zerox456
Copy link

Zerox456 commented Jan 7, 2024

Got it! Thanks for help and share!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment