void chc(int s) { board_t board; chc_init(s, board); mainloop(s, board); close(s); add_io(0, 0); if(chc_my) pressanykey(); }
int chc(int s,user_info *uin2) { board_t board; uin = uin2; chc_init(s, board); mainloop(s, board); close(s); add_io(0, 0); if(chc_my) pressanykey("下次再來繼續對決吧....:p"); }
/** Self-test the hash @return CRYPT_OK if successful, CRYPT_NOP if self-tests have been disabled */ int chc_test(void) { static const struct { unsigned char *msg, md[MAXBLOCKSIZE]; int len; } tests[] = { { (unsigned char *)"hello world", { 0xcf, 0x57, 0x9d, 0xc3, 0x0a, 0x0e, 0xea, 0x61, 0x0d, 0x54, 0x47, 0xc4, 0x3c, 0x06, 0xf5, 0x4e }, 16 } }; int x, oldhashidx, idx; unsigned char out[MAXBLOCKSIZE]; hash_state md; /* AES can be under rijndael or aes... try to find it */ if ((idx = find_cipher("aes")) == -1) { if ((idx = find_cipher("rijndael")) == -1) { return CRYPT_NOP; } } oldhashidx = cipher_idx; chc_register(idx); for (x = 0; x < (int)(sizeof(tests)/sizeof(tests[0])); x++) { chc_init(&md); chc_process(&md, tests[x].msg, strlen((char *)tests[x].msg)); chc_done(&md, out); if (XMEMCMP(out, tests[x].md, tests[x].len)) { return CRYPT_FAIL_TESTVECTOR; } } if (oldhashidx != UNDEFED_HASH) { chc_register(oldhashidx); } return CRYPT_OK; }