本文整理汇总了C++中ARCH_INDEX函数的典型用法代码示例。如果您正苦于以下问题:C++ ARCH_INDEX函数的具体用法?C++ ARCH_INDEX怎么用?C++ ARCH_INDEX使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ARCH_INDEX函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: sha512_common_binary
/* ------- Binary ------- */
void * sha512_common_binary(char *ciphertext)
{
static unsigned char * out;
char *p;
int i;
if (!out) out = mem_calloc_tiny(BINARY_SIZE, MEM_ALIGN_WORD);
p = ciphertext + TAG_LENGTH;
for (i = 0; i < BINARY_SIZE; i++) {
out[i] =
(atoi16[ARCH_INDEX(*p)] << 4) |
atoi16[ARCH_INDEX(p[1])];
p += 2;
}
#ifdef SIMD_COEF_64
alter_endianity_to_BE64(out, BINARY_SIZE/8);
#endif
return out;
}
开发者ID:Allen-smith,项目名称:ctf-tools,代码行数:22,代码来源:rawSHA512_common_plug.c
示例2: Challenge
/* We're essentially using three salts, but we're going to pack it into a single blob for now.
|Client Challenge (8 Bytes)|Server Challenge (8 Bytes)|Unicode(Username (<=20).Domain (<=15))
*/
static void *get_salt(char *ciphertext)
{
static unsigned char *binary_salt;
unsigned char identity[USERNAME_LENGTH + DOMAIN_LENGTH + 1];
UTF16 identity_ucs2[USERNAME_LENGTH + DOMAIN_LENGTH + 1];
int i, identity_length;
int identity_ucs2_length;
char *pos = NULL;
if (!binary_salt) binary_salt = mem_alloc_tiny(SALT_SIZE, MEM_ALIGN_WORD);
/* Calculate identity length */
for (pos = ciphertext + 9; *pos != '$'; pos++);
identity_length = pos - (ciphertext + 9);
/* Convert identity (username + domain) string to NT unicode */
strnzcpy((char *)identity, ciphertext + 9, sizeof(identity));
identity_ucs2_length = enc_to_utf16((UTF16 *)identity_ucs2, USERNAME_LENGTH + DOMAIN_LENGTH, (UTF8 *)identity, identity_length) * sizeof(int16);
if (identity_ucs2_length < 0) // Truncated at Unicode conversion.
identity_ucs2_length = strlen16((UTF16 *)identity_ucs2) * sizeof(int16);
binary_salt[16] = (unsigned char)identity_ucs2_length;
memcpy(&binary_salt[17], (char *)identity_ucs2, identity_ucs2_length);
/* Set server challenge */
ciphertext += 10 + identity_length;
for (i = 0; i < 8; i++)
binary_salt[i] = (atoi16[ARCH_INDEX(ciphertext[i*2])] << 4) + atoi16[ARCH_INDEX(ciphertext[i*2+1])];
/* Set client challenge */
ciphertext += 2 + CHALLENGE_LENGTH / 2 + CIPHERTEXT_LENGTH;
for (i = 0; i < 8; ++i)
binary_salt[i + 8] = (atoi16[ARCH_INDEX(ciphertext[i*2])] << 4) + atoi16[ARCH_INDEX(ciphertext[i*2+1])];
/* Return a concatenation of the server and client challenges and the identity value */
return (void*)binary_salt;
}
开发者ID:balidani,项目名称:JohnTheRipper,代码行数:43,代码来源:NETLMv2_fmt_plug.c
示例3: memset
//code from historical JtR phpass patch
static void *get_binary(char *ciphertext)
{
static unsigned char b[BINARY_SIZE];
int i, bidx = 0;
unsigned sixbits;
char *pos = &ciphertext[3 + 1 + 8];
memset(b, 0, BINARY_SIZE);
for (i = 0; i < 5; i++) {
sixbits = atoi64[ARCH_INDEX(*pos++)];
b[bidx] = sixbits;
sixbits = atoi64[ARCH_INDEX(*pos++)];
b[bidx++] |= (sixbits << 6);
sixbits >>= 2;
b[bidx] = sixbits;
sixbits = atoi64[ARCH_INDEX(*pos++)];
b[bidx++] |= (sixbits << 4);
sixbits >>= 4;
b[bidx] = sixbits;
sixbits = atoi64[ARCH_INDEX(*pos++)];
b[bidx++] |= (sixbits << 2);
}
sixbits = atoi64[ARCH_INDEX(*pos++)];
b[bidx] = sixbits;
sixbits = atoi64[ARCH_INDEX(*pos++)];
b[bidx] |= (sixbits << 6);
return (void *) b;
}
开发者ID:Allen-smith,项目名称:ctf-tools,代码行数:29,代码来源:opencl_phpass_fmt_plug.c
示例4: wpapsk_binary
static void * wpapsk_binary(char *ciphertext)
{
static unsigned char realcipher[BINARY_SIZE];
int i,pos;
for(i=0;ciphertext[i]!='#';i++);
pos=i+1;
for(i=0;i<BINARY_SIZE;i++)
{
realcipher[i] = atoi16[ARCH_INDEX(ciphertext[i*2+pos])]*16 + atoi16[ARCH_INDEX(ciphertext[i*2+1+pos])];
}
pos += i*2+1;
i=0;
while(ciphertext[pos]!=' ')
{
DATA[i] = atoi16[ARCH_INDEX(ciphertext[pos])]*16 + atoi16[ARCH_INDEX(ciphertext[1+pos])];
i++;
pos += 2;
}
memcpy(nDATA+23, DATA, 12+64);
pos++;
i=0;
while(ciphertext[pos])
{
EAPOL[i] = atoi16[ARCH_INDEX(ciphertext[pos])]*16 + atoi16[ARCH_INDEX(ciphertext[1+pos])];
i++;
pos += 2;
}
return (void *)realcipher;
}
开发者ID:ZenBench,项目名称:client,代码行数:31,代码来源:WPAPSK_fmt.c
示例5: strdup
static void *get_salt(char *ciphertext)
{
char *ctcopy = strdup(ciphertext);
char *keeptr = ctcopy;
int i;
char *p;
salt_struct = mem_calloc_tiny(sizeof(struct custom_salt),
MEM_ALIGN_WORD);
ctcopy += 11; /* skip over "$keychain$*" */
p = strtokm(ctcopy, "*");
for (i = 0; i < SALTLEN; i++)
salt_struct->salt[i] = atoi16[ARCH_INDEX(p[i * 2])] * 16
+ atoi16[ARCH_INDEX(p[i * 2 + 1])];
p = strtokm(NULL, "*");
for (i = 0; i < IVLEN; i++)
salt_struct->iv[i] = atoi16[ARCH_INDEX(p[i * 2])] * 16
+ atoi16[ARCH_INDEX(p[i * 2 + 1])];
p = strtokm(NULL, "*");
for (i = 0; i < CTLEN; i++)
salt_struct->ct[i] = atoi16[ARCH_INDEX(p[i * 2])] * 16
+ atoi16[ARCH_INDEX(p[i * 2 + 1])];
MEM_FREE(keeptr);
return (void *)salt_struct;
}
开发者ID:Allen-smith,项目名称:ctf-tools,代码行数:26,代码来源:opencl_keychain_fmt_plug.c
示例6: strdup
static void *get_salt(char *ciphertext)
{
char *ctcopy = strdup(ciphertext);
char *keeptr = ctcopy;
int i;
char *p;
ctcopy += 5; /* skip over "$pdf$" marker */
salt_struct = mem_calloc_tiny(sizeof(struct custom_salt), MEM_ALIGN_WORD);
/* restore serialized data */
salt_struct->e.s_handler = strtok(ctcopy, "*");
salt_struct->e.o_string = (uint8_t *) malloc(32);
p = strtok(NULL, "*");
for (i = 0; i < 32; i++)
salt_struct->e.o_string[i] =
atoi16[ARCH_INDEX(p[i * 2])] * 16 +
atoi16[ARCH_INDEX(p[i * 2 + 1])];
salt_struct->e.u_string = (uint8_t *) malloc(32);
p = strtok(NULL, "*");
for (i = 0; i < 32; i++)
salt_struct->e.u_string[i] =
atoi16[ARCH_INDEX(p[i * 2])] * 16 +
atoi16[ARCH_INDEX(p[i * 2 + 1])];
p = strtok(NULL, "*");
salt_struct->e.fileIDLen = atoi(p);
salt_struct->e.fileID = (uint8_t *) malloc(salt_struct->e.fileIDLen);
p = strtok(NULL, "*");
for (i = 0; i < salt_struct->e.fileIDLen; i++)
salt_struct->e.fileID[i] =
atoi16[ARCH_INDEX(p[i * 2])] * 16 +
atoi16[ARCH_INDEX(p[i * 2 + 1])];
p = strtok(NULL, "*");
salt_struct->e.encryptMetaData = atoi(p);
p = strtok(NULL, "*");
salt_struct->e.work_with_user = atoi(p);
p = strtok(NULL, "*");
salt_struct->e.have_userpassword = atoi(p);
p = strtok(NULL, "*");
salt_struct->e.version_major = atoi(p);
p = strtok(NULL, "*");
salt_struct->e.version_minor = atoi(p);
p = strtok(NULL, "*");
salt_struct->e.length = atoi(p);
p = strtok(NULL, "*");
salt_struct->e.permissions = atoi(p);
p = strtok(NULL, "*");
salt_struct->e.revision = atoi(p);
p = strtok(NULL, "*");
salt_struct->e.version = atoi(p);
if (salt_struct->e.have_userpassword)
salt_struct->userpassword = (unsigned char *)strtok(NULL, "*");
free(keeptr);
/* try to initialize the cracking-engine */
if (!initPDFCrack(salt_struct)) {
fprintf(stderr, "Wrong userpassword, '%s'\n", salt_struct->userpassword);
exit(-1);
}
return (void *)salt_struct;
}
开发者ID:Sayantan2048,项目名称:myrice-JtR,代码行数:60,代码来源:pdf_fmt.c
示例7: strdup
static void *get_salt(char *ciphertext)
{
char *ctcopy = strdup(ciphertext);
char *keeptr = ctcopy;
char *p;
int i;
memset(&cs, 0, sizeof(cs));
ctcopy += TAG_LEN; /* skip over "$oldoffice$" */
p = strtok(ctcopy, "*");
cs.type = atoi(p);
p = strtok(NULL, "*");
for (i = 0; i < 16; i++)
cs.salt[i] = atoi16[ARCH_INDEX(p[i * 2])] * 16
+ atoi16[ARCH_INDEX(p[i * 2 + 1])];
p = strtok(NULL, "*");
for (i = 0; i < 16; i++)
cs.verifier[i] = atoi16[ARCH_INDEX(p[i * 2])] * 16
+ atoi16[ARCH_INDEX(p[i * 2 + 1])];
p = strtok(NULL, "*");
if(cs.type < 3) {
for (i = 0; i < 16; i++)
cs.verifierHash[i] = atoi16[ARCH_INDEX(p[i * 2])] * 16
+ atoi16[ARCH_INDEX(p[i * 2 + 1])];
}
else {
for (i = 0; i < 20; i++)
cs.verifierHash[i] = atoi16[ARCH_INDEX(p[i * 2])] * 16
+ atoi16[ARCH_INDEX(p[i * 2 + 1])];
}
if ((p = strtok(NULL, "*"))) {
cs.has_mitm = 1;
for (i = 0; i < 5; i++)
cs.mitm[i] = atoi16[ARCH_INDEX(p[i * 2])] * 16
+ atoi16[ARCH_INDEX(p[i * 2 + 1])];
} else
cs.has_mitm = 0;
MEM_FREE(keeptr);
return (void *)&cs;
}
开发者ID:mimaun,项目名称:Rose,代码行数:40,代码来源:opencl_oldoffice_fmt_plug.c
示例8: strdup
static void *get_salt(char *ciphertext)
{
int i, length;
char *ctcopy = strdup(ciphertext);
char *keeptr = ctcopy, *p;
ctcopy += 9; /* skip over "$office$*" */
cur_salt = mem_alloc_tiny(sizeof(struct custom_salt), MEM_ALIGN_WORD);
p = strtok(ctcopy, "*");
cur_salt->version = atoi(p);
p = strtok(NULL, "*");
cur_salt->verifierHashSize = atoi(p);
p = strtok(NULL, "*");
cur_salt->keySize = atoi(p);
p = strtok(NULL, "*");
cur_salt->saltSize = atoi(p);
if (cur_salt->saltSize > SALT_LENGTH) {
fprintf(stderr, "** error: salt longer than supported:\n%s\n", ciphertext);
cur_salt->saltSize = SALT_LENGTH; /* will not work, but protects us from segfault */
}
p = strtok(NULL, "*");
for (i = 0; i < cur_salt->saltSize; i++)
cur_salt->osalt[i] = atoi16[ARCH_INDEX(p[i * 2])] * 16
+ atoi16[ARCH_INDEX(p[i * 2 + 1])];
p = strtok(NULL, "*");
for (i = 0; i < 16; i++)
cur_salt->encryptedVerifier[i] = atoi16[ARCH_INDEX(p[i * 2])] * 16
+ atoi16[ARCH_INDEX(p[i * 2 + 1])];
p = strtok(NULL, "*");
length = strlen(p) / 2;
for (i = 0; i < length; i++)
cur_salt->encryptedVerifierHash[i] = atoi16[ARCH_INDEX(p[i * 2])] * 16
+ atoi16[ARCH_INDEX(p[i * 2 + 1])];
MEM_FREE(keeptr);
return (void *)cur_salt;
}
开发者ID:bhargavz,项目名称:pac4mac,代码行数:35,代码来源:opencl_office2007_fmt.c
示例9: strdup
static void *get_salt(char *ciphertext)
{
char *ctcopy = strdup(ciphertext);
char *keeptr = ctcopy;
int i;
char *p;
static union {
struct custom_salt _cs;
ARCH_WORD_32 dummy;
} un;
struct custom_salt *cs = &(un._cs);
ctcopy += 4;
p = strtokm(ctcopy, "$");
cs->type = atoi(p);
p = strtokm(NULL, "$");
cs->NumCyclesPower = atoi(p);
p = strtokm(NULL, "$");
cs->SaltSize = atoi(p);
p = strtokm(NULL, "$"); /* salt */
p = strtokm(NULL, "$");
cs->ivSize = atoi(p);
p = strtokm(NULL, "$"); /* iv */
for (i = 0; i < cs->ivSize; i++)
cs->iv[i] = atoi16[ARCH_INDEX(p[i * 2])] * 16
+ atoi16[ARCH_INDEX(p[i * 2 + 1])];
p = strtokm(NULL, "$"); /* crc */
cs->crc = atou(p);
p = strtokm(NULL, "$");
cs->length = atoi(p);
p = strtokm(NULL, "$");
cs->unpacksize = atoi(p);
p = strtokm(NULL, "$"); /* crc */
for (i = 0; i < cs->length; i++)
cs->data[i] = atoi16[ARCH_INDEX(p[i * 2])] * 16
+ atoi16[ARCH_INDEX(p[i * 2 + 1])];
MEM_FREE(keeptr);
return (void *)cs;
}
开发者ID:Allen-smith,项目名称:ctf-tools,代码行数:40,代码来源:opencl_7z_fmt_plug.c
示例10: pbinary
///code from historical JtR phpass patch
static void pbinary(char *ciphertext, unsigned char *out)
{
int i, bidx = 0;
unsigned sixbits;
char *pos = &ciphertext[3 + 1 + 8];
memset(out, 0, BINARY_SIZE);
for (i = 0; i < 5; i++) {
sixbits = atoi64[ARCH_INDEX(*pos++)];
out[bidx] = sixbits;
sixbits = atoi64[ARCH_INDEX(*pos++)];
out[bidx++] |= (sixbits << 6);
sixbits >>= 2;
out[bidx] = sixbits;
sixbits = atoi64[ARCH_INDEX(*pos++)];
out[bidx++] |= (sixbits << 4);
sixbits >>= 4;
out[bidx] = sixbits;
sixbits = atoi64[ARCH_INDEX(*pos++)];
out[bidx++] |= (sixbits << 2);
}
sixbits = atoi64[ARCH_INDEX(*pos++)];
out[bidx] = sixbits;
sixbits = atoi64[ARCH_INDEX(*pos++)];
out[bidx] |= (sixbits << 6);
}
开发者ID:bhargavz,项目名称:pac4mac,代码行数:27,代码来源:cuda_phpass_fmt.c
示例11: valid
static int valid(char *ciphertext, struct fmt_main *self)
{
char *pos, *start;
if (strncmp(ciphertext, "$1$", 3)) {
if (strncmp(ciphertext, "$apr1$", 6) &&
strncmp(ciphertext, "{smd5}", 6))
return 0;
ciphertext += 3;
}
for (pos = &ciphertext[3]; *pos && *pos != '$'; pos++);
if (!*pos || pos < &ciphertext[3] || pos > &ciphertext[11]) return 0;
start = ++pos;
while (atoi64[ARCH_INDEX(*pos)] != 0x7F) pos++;
if (*pos || pos - start != CIPHERTEXT_LENGTH) return 0;
if (atoi64[ARCH_INDEX(*(pos - 1))] & 0x3C) return 0;
return 1;
}
开发者ID:balidani,项目名称:JohnTheRipper,代码行数:22,代码来源:MD5_fmt.c
示例12: valid
static int valid(char *ciphertext, struct fmt_main *pFmt)
{
uint8_t i, len = strlen(ciphertext), prefix = 0;
if (strncmp(ciphertext, md5_salt_prefix, strlen(md5_salt_prefix)) == 0)
prefix |= 1;
if (strncmp(ciphertext, apr1_salt_prefix,
strlen(apr1_salt_prefix)) == 0)
prefix |= 2;
if (prefix == 0)
return 0;
char *p = strrchr(ciphertext, '$');
for (i = p - ciphertext + 1; i < len; i++) {
uint8_t z = ARCH_INDEX(ciphertext[i]);
if (ARCH_INDEX(atoi64[z]) == 0x7f)
return 0;
}
if (len - (p - ciphertext + 1) != 22)
return 0;
return 1;
};
开发者ID:samueletonon,项目名称:samu,代码行数:22,代码来源:cryptmd5_opencl_fmt.c
示例13: valid
static int valid(char* ciphertext, struct fmt_main *self)
{
unsigned int i;
if (strlen(ciphertext) != CIPHERTEXT_LENGTH)
return 0;
for (i = 0; i < CIPHERTEXT_LENGTH; i++)
if (atoi16[ARCH_INDEX(ciphertext[i])] > 15)
return 0;
return 1;
}
开发者ID:mimaun,项目名称:Rose,代码行数:13,代码来源:mysql_fmt_plug.c
示例14: valid
static int valid(char *ciphertext, struct fmt_main *self)
{
char *p, *q;
if (strncmp(ciphertext, "$mysqlna$", 9))
return 0;
p = ciphertext + 9;
q = strstr(ciphertext, "*");
if(!q)
return 0;
if (q - p != CIPHERTEXT_LENGTH)
return 0;
while (atoi16[ARCH_INDEX(*p)] != 0x7F && p < q)
p++;
if (q - p != 0)
return 0;
if(strlen(p) < CIPHERTEXT_LENGTH)
return 0;
q = p + 1;
while (atoi16[ARCH_INDEX(*q)] != 0x7F)
q++;
return !*q && q - p - 1 == CIPHERTEXT_LENGTH;
}
开发者ID:balidani,项目名称:JohnTheRipper,代码行数:22,代码来源:mysql_netauth_fmt_plug.c
示例15: valid
static int valid(char *ciphertext, struct fmt_main *self)
{
char *pos;
/* Require lowercase hex digits (assume ASCII) */
pos = ciphertext;
if (strncmp(pos, "$LION$", 6))
return 0;
pos += 6;
while (atoi16[ARCH_INDEX(*pos)] != 0x7F && (*pos <= '9' || *pos >= 'a'))
pos++;
return !*pos && pos - ciphertext == CIPHERTEXT_LENGTH+6;
}
开发者ID:mimaun,项目名称:Rose,代码行数:13,代码来源:XSHA512_fmt_plug.c
示例16: strrchr
// Don't copy this code without realising it mimics bugs in the original code!
// We are actually missing the last 16 bits with this implementation.
static void *get_binary(char *ciphertext)
{
static ARCH_WORD_32 outbuf[BINARY_SIZE/4];
ARCH_WORD_32 value;
char *pos;
unsigned char *out = (unsigned char*)outbuf;
int i;
pos = strrchr(ciphertext, '$') + 1;
for (i = 0; i < 20; i++) {
TO_BINARY(i, i + 21, i + 42);
}
value = (ARCH_WORD_32)atoi64[ARCH_INDEX(pos[0])] |
((ARCH_WORD_32)atoi64[ARCH_INDEX(pos[1])] << 6) |
((ARCH_WORD_32)atoi64[ARCH_INDEX(pos[2])] << 12) |
((ARCH_WORD_32)atoi64[ARCH_INDEX(pos[3])] << 18);
out[20] = value >> 16;
out[41] = value >> 8;
return (void *)out;
}
开发者ID:Sayantan2048,项目名称:myrice-JtR,代码行数:24,代码来源:dragonfly4_fmt.c
示例17: valid
static int valid(char *ciphertext, struct fmt_main *self)
{
char *pos;
char lower[CIPHERTEXT_LENGTH - 16 + 1];
for (pos = ciphertext; atoi16[ARCH_INDEX(*pos)] != 0x7F; pos++);
if (!*pos && pos - ciphertext == CIPHERTEXT_LENGTH) {
strcpy(lower, &ciphertext[16]);
strlwr(lower);
if (strcmp(lower, LM_EMPTY))
return 2;
else
return 1;
}
if (strncmp(ciphertext, "$LM$", 4)) return 0;
for (pos = &ciphertext[4]; atoi16[ARCH_INDEX(*pos)] != 0x7F; pos++);
if (*pos || pos - ciphertext != 20) return 0;
return 1;
}
开发者ID:bhargavz,项目名称:pac4mac,代码行数:22,代码来源:LM_fmt.c
示例18:
static void *get_binary(char *ciphertext)
{
static unsigned char out[FULL_BINARY_SIZE];
char *p;
int i;
uint64_t *b;
p = ciphertext;
for (i = 0; i < sizeof(out); i++) {
out[i] =
(atoi16[ARCH_INDEX(*p)] << 4) |
atoi16[ARCH_INDEX(p[1])];
p += 2;
}
b = (uint64_t*)out;
for (i = 0; i < 8; i++) {
uint64_t t = SWAP64(b[i])-H[i];
b[i] = SWAP64(t);
}
return out;
}
开发者ID:balidani,项目名称:JohnTheRipper,代码行数:22,代码来源:opencl_rawsha512_fmt.c
示例19: sha512_common_valid_xsha
int sha512_common_valid_xsha(char *ciphertext, struct fmt_main *self)
{
char *pos;
/* Require lowercase hex digits (assume ASCII) */
pos = ciphertext;
if (strncmp(pos, XSHA512_FORMAT_TAG, XSHA512_TAG_LENGTH))
return 0;
pos += 6;
while (atoi16[ARCH_INDEX(*pos)] != 0x7F && (*pos <= '9' || *pos >= 'a'))
pos++;
return !*pos && pos - ciphertext == XSHA512_CIPHERTEXT_LENGTH+6;
}
开发者ID:Allen-smith,项目名称:ctf-tools,代码行数:13,代码来源:rawSHA512_common_plug.c
示例20: valid
static int valid(char *ciphertext, struct fmt_main *self)
{
char *p, *q;
p = ciphertext;
if (!strncmp(p, FORMAT_TAG, TAG_LENGTH))
p += 8;
q = p;
while (atoi16[ARCH_INDEX(*q)] != 0x7F)
q++;
return !*q && q - p == CIPHERTEXT_LENGTH;
}
开发者ID:Allen-smith,项目名称:ctf-tools,代码行数:13,代码来源:rawSHA384_fmt_plug.c
注:本文中的ARCH_INDEX函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论