mirror of
https://github.com/GOSTSec/vanitygen
synced 2025-02-07 12:24:20 +00:00
Add fdumphex() and fdumpbn() for use with stderr.
This commit is contained in:
parent
5fb1fe9119
commit
d0dbe37a3b
@ -1544,9 +1544,10 @@ vg_ocl_prefix_check(vg_ocl_context_t *vocp, int slot)
|
|||||||
tablesize = ocl_found_out[2];
|
tablesize = ocl_found_out[2];
|
||||||
fprintf(stderr, "Match idx: %d\n", ocl_found_out[1]);
|
fprintf(stderr, "Match idx: %d\n", ocl_found_out[1]);
|
||||||
fprintf(stderr, "CPU hash: ");
|
fprintf(stderr, "CPU hash: ");
|
||||||
dumphex(vxcp->vxc_binres + 1, 20);
|
fdumphex(stderr, vxcp->vxc_binres + 1, 20);
|
||||||
fprintf(stderr, "GPU hash: ");
|
fprintf(stderr, "GPU hash: ");
|
||||||
dumphex((unsigned char *) (ocl_found_out + 2), 20);
|
fdumphex(stderr,
|
||||||
|
(unsigned char *) (ocl_found_out + 2), 20);
|
||||||
fprintf(stderr, "Found delta: %d "
|
fprintf(stderr, "Found delta: %d "
|
||||||
"Start delta: %d\n",
|
"Start delta: %d\n",
|
||||||
found_delta, orig_delta);
|
found_delta, orig_delta);
|
||||||
@ -1689,7 +1690,7 @@ vg_ocl_verify_temporary(vg_ocl_context_t *vocp, int slot, int z_inverted)
|
|||||||
BN_cmp(&bnz, bnzc)) {
|
BN_cmp(&bnz, bnzc)) {
|
||||||
if (!mismatches) {
|
if (!mismatches) {
|
||||||
fprintf(stderr, "Base privkey: ");
|
fprintf(stderr, "Base privkey: ");
|
||||||
dumpbn(EC_KEY_get0_private_key(
|
fdumpbn(stderr, EC_KEY_get0_private_key(
|
||||||
vxcp->vxc_key));
|
vxcp->vxc_key));
|
||||||
}
|
}
|
||||||
mismatches++;
|
mismatches++;
|
||||||
@ -1699,33 +1700,33 @@ vg_ocl_verify_temporary(vg_ocl_context_t *vocp, int slot, int z_inverted)
|
|||||||
if (!mm_r) {
|
if (!mm_r) {
|
||||||
mm_r = 1;
|
mm_r = 1;
|
||||||
fprintf(stderr, "Row X : ");
|
fprintf(stderr, "Row X : ");
|
||||||
dumpbn(&ppr->X);
|
fdumpbn(stderr, &ppr->X);
|
||||||
fprintf(stderr, "Row Y : ");
|
fprintf(stderr, "Row Y : ");
|
||||||
dumpbn(&ppr->Y);
|
fdumpbn(stderr, &ppr->Y);
|
||||||
}
|
}
|
||||||
|
|
||||||
fprintf(stderr, "Column X: ");
|
fprintf(stderr, "Column X: ");
|
||||||
dumpbn(&ppc->X);
|
fdumpbn(stderr, &ppc->X);
|
||||||
fprintf(stderr, "Column Y: ");
|
fprintf(stderr, "Column Y: ");
|
||||||
dumpbn(&ppc->Y);
|
fdumpbn(stderr, &ppc->Y);
|
||||||
|
|
||||||
if (BN_cmp(&ppt->X, &pps->X)) {
|
if (BN_cmp(&ppt->X, &pps->X)) {
|
||||||
fprintf(stderr, "Expect X: ");
|
fprintf(stderr, "Expect X: ");
|
||||||
dumpbn(&pps->X);
|
fdumpbn(stderr, &pps->X);
|
||||||
fprintf(stderr, "Device X: ");
|
fprintf(stderr, "Device X: ");
|
||||||
dumpbn(&ppt->X);
|
fdumpbn(stderr, &ppt->X);
|
||||||
}
|
}
|
||||||
if (BN_cmp(&ppt->Y, &pps->Y)) {
|
if (BN_cmp(&ppt->Y, &pps->Y)) {
|
||||||
fprintf(stderr, "Expect Y: ");
|
fprintf(stderr, "Expect Y: ");
|
||||||
dumpbn(&pps->Y);
|
fdumpbn(stderr, &pps->Y);
|
||||||
fprintf(stderr, "Device Y: ");
|
fprintf(stderr, "Device Y: ");
|
||||||
dumpbn(&ppt->Y);
|
fdumpbn(stderr, &ppt->Y);
|
||||||
}
|
}
|
||||||
if (BN_cmp(&bnz, bnzc)) {
|
if (BN_cmp(&bnz, bnzc)) {
|
||||||
fprintf(stderr, "Expect Z: ");
|
fprintf(stderr, "Expect Z: ");
|
||||||
dumpbn(bnzc);
|
fdumpbn(stderr, bnzc);
|
||||||
fprintf(stderr, "Device Z: ");
|
fprintf(stderr, "Device Z: ");
|
||||||
dumpbn(&bnz);
|
fdumpbn(stderr, &bnz);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
20
util.c
20
util.c
@ -60,25 +60,37 @@ const signed char vg_b58_reverse_map[256] = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
void
|
void
|
||||||
dumphex(const unsigned char *src, size_t len)
|
fdumphex(FILE *fp, const unsigned char *src, size_t len)
|
||||||
{
|
{
|
||||||
size_t i;
|
size_t i;
|
||||||
for (i = 0; i < len; i++) {
|
for (i = 0; i < len; i++) {
|
||||||
printf("%02x", src[i]);
|
fprintf(fp, "%02x", src[i]);
|
||||||
}
|
}
|
||||||
printf("\n");
|
printf("\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
dumpbn(const BIGNUM *bn)
|
fdumpbn(FILE *fp, const BIGNUM *bn)
|
||||||
{
|
{
|
||||||
char *buf;
|
char *buf;
|
||||||
buf = BN_bn2hex(bn);
|
buf = BN_bn2hex(bn);
|
||||||
printf("%s\n", buf ? buf : "0");
|
fprintf(stderr, "%s\n", buf ? buf : "0");
|
||||||
if (buf)
|
if (buf)
|
||||||
OPENSSL_free(buf);
|
OPENSSL_free(buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
dumphex(const unsigned char *src, size_t len)
|
||||||
|
{
|
||||||
|
fdumphex(stdout, src, len);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
dumpbn(const BIGNUM *bn)
|
||||||
|
{
|
||||||
|
fdumpbn(stdout, bn);
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Key format encode/decode
|
* Key format encode/decode
|
||||||
*/
|
*/
|
||||||
|
3
util.h
3
util.h
@ -19,6 +19,7 @@
|
|||||||
#if !defined (__VG_UTIL_H__)
|
#if !defined (__VG_UTIL_H__)
|
||||||
#define __VG_UTIL_H__
|
#define __VG_UTIL_H__
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
#include <openssl/bn.h>
|
#include <openssl/bn.h>
|
||||||
@ -27,6 +28,8 @@
|
|||||||
extern const char *vg_b58_alphabet;
|
extern const char *vg_b58_alphabet;
|
||||||
extern const signed char vg_b58_reverse_map[256];
|
extern const signed char vg_b58_reverse_map[256];
|
||||||
|
|
||||||
|
extern void fdumphex(FILE *fp, const unsigned char *src, size_t len);
|
||||||
|
extern void fdumpbn(FILE *fp, const BIGNUM *bn);
|
||||||
extern void dumphex(const unsigned char *src, size_t len);
|
extern void dumphex(const unsigned char *src, size_t len);
|
||||||
extern void dumpbn(const BIGNUM *bn);
|
extern void dumpbn(const BIGNUM *bn);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user