Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add mode zeroBytes #36

Merged
merged 6 commits into from
Feb 24, 2024
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions Mode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,13 @@ Mode Mode::range(const cl_uchar min, const cl_uchar max) {
return r;
}

Mode Mode::zeroBytes() {
Mode r;
r.name = "zeroBytes";
r.kernel = "profanity_score_zerobytes";
return r;
}

Mode Mode::letters() {
Mode r = range(10, 15);
r.name = "letters";
Expand Down
1 change: 1 addition & 0 deletions Mode.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ class Mode {

static Mode benchmark();
static Mode zeros();
static Mode zeroBytes();
static Mode letters();
static Mode numbers();
static Mode doubles();
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ usage: ./profanity2 [OPTIONS]
--numbers Score on numbers anywhere in hash.
--mirror Score on mirroring from center.
--leading-doubles Score on hashes leading with hexadecimal pairs
--zero-bytes Score on hashes containing the most zero bytes
k06a marked this conversation as resolved.
Show resolved Hide resolved

Modes with arguments:
--leading <single hex> Score on hashes leading with given hex character.
Expand Down Expand Up @@ -93,6 +94,7 @@ usage: ./profanity2 [OPTIONS]
./profanity2 --leading-range -m 10 -M 12 -z HEX_PUBLIC_KEY_128_CHARS_LONG
./profanity2 --range -m 0 -M 1 -z HEX_PUBLIC_KEY_128_CHARS_LONG
./profanity2 --contract --leading 0 -z HEX_PUBLIC_KEY_128_CHARS_LONG
./profanity2 --contract --zero-bytes -z HEX_PUBLIC_KEY_128_CHARS_LONG

About:
profanity2 is a vanity address generator for Ethereum that utilizes
Expand Down
1 change: 1 addition & 0 deletions help.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ usage: ./profanity2 [OPTIONS]
--numbers Score on numbers anywhere in hash.
--mirror Score on mirroring from center.
--leading-doubles Score on hashes leading with hexadecimal pairs
--zero-bytes Score on hashes containing the most zero bytes
k06a marked this conversation as resolved.
Show resolved Hide resolved

Modes with arguments:
--leading <single hex> Score on hashes leading with given hex character.
Expand Down
14 changes: 14 additions & 0 deletions profanity.cl
Original file line number Diff line number Diff line change
Expand Up @@ -784,6 +784,20 @@ __kernel void profanity_score_range(__global mp_number * const pInverse, __globa
profanity_result_update(id, hash, pResult, score, scoreMax);
}

__kernel void profanity_score_zerobytes(__global mp_number * const pInverse, __global result * const pResult, __constant const uchar * const data1, __constant const uchar * const data2, const uchar scoreMax) {
const size_t id = get_global_id(0);
__global const uchar * const hash = pInverse[id].d;
int score = 0;

for (int i = 0; i < 20; ++i) {
if (hash[i] == 0) {
score++;
}
}

profanity_result_update(id, hash, pResult, score, scoreMax);
}

__kernel void profanity_score_leadingrange(__global mp_number * const pInverse, __global result * const pResult, __constant const uchar * const data1, __constant const uchar * const data2, const uchar scoreMax) {
const size_t id = get_global_id(0);
__global const uchar * const hash = pInverse[id].d;
Expand Down
4 changes: 4 additions & 0 deletions profanity.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@ int main(int argc, char * * argv) {
bool bHelp = false;
bool bModeBenchmark = false;
bool bModeZeros = false;
bool bModeZeroBytes = false;
bool bModeLetters = false;
bool bModeNumbers = false;
std::string strModeLeading;
Expand Down Expand Up @@ -191,6 +192,7 @@ int main(int argc, char * * argv) {
argp.addSwitch('I', "inverse-multiple", inverseMultiple);
argp.addSwitch('c', "contract", bMineContract);
argp.addSwitch('z', "publicKey", strPublicKey);
argp.addSwitch('b', "zero-bytes", bModeZeroBytes);

if (!argp.parse()) {
std::cout << "error: bad arguments, try again :<" << std::endl;
Expand Down Expand Up @@ -223,6 +225,8 @@ int main(int argc, char * * argv) {
mode = Mode::mirror();
} else if (bModeDoubles) {
mode = Mode::doubles();
} else if (bModeZeroBytes) {
mode = Mode::zeroBytes();
} else {
std::cout << g_strHelp << std::endl;
return 0;
Expand Down