Bitcoin/address validation: Difference between revisions
Content deleted Content added
→{{header|Perl 6}}: slight simplification |
|||
Line 32: | Line 32: | ||
#define bail(s) { coin_err = s; return 0; } |
#define bail(s) { coin_err = s; return 0; } |
||
int unbase58(char *s, unsigned char *out) { |
int unbase58(const char *s, unsigned char *out) { |
||
static char *tmpl = "123456789" |
static const char *tmpl = "123456789" |
||
"ABCDEFGHJKLMNPQRSTUVWXYZ" |
"ABCDEFGHJKLMNPQRSTUVWXYZ" |
||
"abcdefghijkmnopqrstuvwxyz"; |
"abcdefghijkmnopqrstuvwxyz"; |
||
int i, j, c; |
int i, j, c; |
||
char *p; |
const char *p; |
||
memset(out, 0, 25); |
memset(out, 0, 25); |
||
Line 57: | Line 57: | ||
} |
} |
||
int valid(char *s) { |
int valid(const char *s) { |
||
unsigned char dec[32], d1[SHA256_DIGEST_LENGTH], d2[SHA256_DIGEST_LENGTH]; |
unsigned char dec[32], d1[SHA256_DIGEST_LENGTH], d2[SHA256_DIGEST_LENGTH]; |
||
Line 72: | Line 72: | ||
int main (void) { |
int main (void) { |
||
char *s[] = { |
const char *s[] = { |
||
"1Q1pE5vPGEEMqRcVRMbtBK842Y6Pzo6nK9", |
"1Q1pE5vPGEEMqRcVRMbtBK842Y6Pzo6nK9", |
||
"1AGNa15ZQXAZUgFiqJ2i7Z2DPU2J6hW62i", |
"1AGNa15ZQXAZUgFiqJ2i7Z2DPU2J6hW62i", |