/* note that this call terminates the key input phase */ void hmac_sha1_data(const unsigned char data[], unsigned long data_len, hmac_ctx cx[1]) { unsigned int i; if(cx->klen != HMAC_IN_DATA) /* if not yet in data phase */ { if(cx->klen > IN_BLOCK_LENGTH) /* if key is being hashed */ { /* complete the hash and */ sha1_end((unsigned char *)cx->key, cx->ctx); /* store the result as the */ cx->klen = OUT_BLOCK_LENGTH; /* key and set new length */ } /* pad the key if necessary */ memset(cx->key + cx->klen, 0, IN_BLOCK_LENGTH - cx->klen); /* xor ipad into key value */ for(i = 0; i < IN_BLOCK_LENGTH / sizeof(ARCH_WORD_32); ++i) cx->key[i] ^= 0x36363636; /* and start hash operation */ sha1_begin(cx->ctx); sha1_hash(cx->key, IN_BLOCK_LENGTH, cx->ctx); /* mark as now in data mode */ cx->klen = HMAC_IN_DATA; } /* hash the data (if any) */ if(data_len) sha1_hash(data, data_len, cx->ctx); }
void conf_hostid( UCHAR *host_id, char *hostname, char *realm, int bool ) { UCHAR sha1_buf1[SHA1_SIZE]; UCHAR sha1_buf2[SHA1_SIZE]; int j = 0; /* The realm influences the way, the lookup hash gets computed */ if( bool == TRUE ) { sha1_hash( sha1_buf1, hostname, strlen( hostname ) ); sha1_hash( sha1_buf2, realm, strlen( realm ) ); for( j = 0; j < SHA1_SIZE; j++ ) { host_id[j] = sha1_buf1[j] ^ sha1_buf2[j]; } } else {
void on_hash(disk_io_job const* j, create_torrent* t , boost::shared_ptr<piece_manager> storage, disk_io_thread* iothread , int* piece_counter, int* completed_piece , boost::function<void(int)> const* f, error_code* ec) { if (j->ret != 0) { // on error *ec = j->error.ec; iothread->set_num_threads(0); return; } t->set_hash(j->piece, sha1_hash(j->d.piece_hash)); (*f)(*completed_piece); ++(*completed_piece); if (*piece_counter < t->num_pieces()) { iothread->async_hash(storage.get(), *piece_counter , disk_io_job::sequential_access , boost::bind(&on_hash, _1, t, storage, iothread , piece_counter, completed_piece, f, ec), NULL); ++(*piece_counter); } else { iothread->abort(true); } iothread->submit_jobs(); }
void fips186_gen::gen_q (bigint *q) { bigint u1, u2; char digest[HASHSIZE]; do { sha1_hash (digest, seed, seedsize << 3); // seedsize * 8 mpz_set_rawmag_le (&u1, digest, HASHSIZE); seed[3]++; sha1_hash (digest, seed, seedsize << 3); // seedsize * 8 mpz_set_rawmag_le (&u2, digest, HASHSIZE); mpz_xor (q, &u1, &u2); mpz_setbit (q, (HASHSIZE << 3) - 1); // set high bit mpz_setbit (q, 0); // set low bit } while (!q->probab_prime (5)); }
bool check_file (const rtftp_file_t &f) { char buf[RTFTP_HASHSZ]; sha1_hash (buf, f.data.base (), f.data.size ()); return (memcmp (buf, f.hash.base (), RTFTP_HASHSZ) == 0); }
acl::acl (str s) : aclstr (s) { assert (aclstr); bzero (hashbuf, sizeof (hashbuf)); bzero (aclhash, sizeof (aclhash)); sha1_hash (aclhash, aclstr.cstr (), aclstr.len ()); }
bigint compute_hash (const void *buf, size_t buflen) { char h[sha1::hashsize]; bzero(h, sha1::hashsize); sha1_hash (h, buf, buflen); bigint n; mpz_set_rawmag_be(&n, h, sha1::hashsize); // For big endian return n; }
void sha1(const std::vector<std::uint8_t> &input, std::vector<std::uint8_t> &output) { static const auto sha1_bytes = 20; output.resize(sha1_bytes); auto output_pointer_u32 = reinterpret_cast<std::uint32_t *>(output.data()); sha1_hash(input.data(), input.size(), output_pointer_u32); byteswap(output_pointer_u32, sha1_bytes / sizeof(std::uint32_t)); }
nodeid_t disk::id(const mempage &block) { uint32_t hash[5]; sha1_hash(block.ptr(), block.size(), hash); BOOST_STATIC_ASSERT(sizeof(nodeid_t) == sizeof(hash)); nodeid_t ret; memcpy(ret.data(), hash, sizeof(hash)); return ret; }
u_int acl::get_permissions (sfsauth_cred *cred, str *key, vec<sfs_idname> *groups) { vec<str> credstrings; u_int p = 0; // 3 kinds of access: anonymous, public key, unix credentials // anonymous means that the user wasn't running an agent or // for some reason the authd couldn't even return a public key if (key) credstrings.push_back (strbuf () << TYPEPK << ACLDIV << *key); if (cred) credstrings.push_back (strbuf () << TYPELOCALUSER << ACLDIV << cred->unixcred->username); if (groups) { for (unsigned int i = 0; i < groups->size (); i++) credstrings.push_back (strbuf () << TYPELOCALGROUP << ACLDIV << (*groups)[i]); } if (!cred && !key) credstrings.push_back (strbuf () << TYPESYS << ACLDIV << SYS_ANONYMOUS); str flattened_creds (""); for (u_int i = 0; i < credstrings.size (); i++) { warn ("CRED[%d]: %s\n", i, credstrings[i].cstr ()); flattened_creds = strbuf () << flattened_creds << credstrings[i]; } #if PCACHE //make hash out of acl and user; ask cache about hash str ua = strbuf () << armor32 (str (aclhash, sizeof (aclhash))) << flattened_creds; bzero (hashbuf, sizeof (hashbuf)); sha1_hash (hashbuf, ua.cstr (), ua.len ()); if (is_cached (hashbuf, p)) { warn << "Using cached perms (" << get_strpermissions (p) << ") for cache key "<< armor32 (str (hashbuf, sizeof (hashbuf))) << "\n"; return p; } else { warn << "Did not find cached perms (" << ua << ") for cache key " << armor32 (str (hashbuf, sizeof (hashbuf))) << "\n"; } #endif p = parse_acl (credstrings); #if PCACHE insert_cache (hashbuf, p); #endif return p; }
/* input the HMAC key (can be called multiple times) */ int hmac_sha1_key(const unsigned char key[], unsigned long key_len, hmac_ctx cx[1]) { if(cx->klen == HMAC_IN_DATA) /* error if further key input */ return HMAC_BAD_MODE; /* is attempted in data mode */ if(cx->klen + key_len > IN_BLOCK_LENGTH) /* if the key has to be hashed */ { if(cx->klen <= IN_BLOCK_LENGTH) /* if the hash has not yet been */ { /* started, initialise it and */ sha1_begin(cx->ctx); /* hash stored key characters */ sha1_hash(cx->key, cx->klen, cx->ctx); } sha1_hash(key, key_len, cx->ctx); /* hash long key data into hash */ } else /* otherwise store key data */ memcpy(cx->key + cx->klen, key, key_len); cx->klen += key_len; /* update the key length count */ return HMAC_OK; }
extern int little_endian_sha1_hash(t_hash * hashout, unsigned int size, void const * datain) { bn_int value; unsigned int i; sha1_hash(hashout, size, datain); for (i = 0; i < 5; i++) { bn_int_nset(&value, (*hashout)[i]); (*hashout)[i] = bn_int_get(value); } return 0; }
guint search_gui_file_hash(gconstpointer key) { const struct result_data *rd = key; const record_t *rc = rd->record; guint hash; hash = rc->size; hash ^= rc->size >> 31; hash ^= rc->sha1 ? sha1_hash(rc->sha1) : 0; return hash; }
BigInt BnetSRP3::getScrambler(BigInt& B) const { unsigned char raw_B[32]; t_uint32 scrambler; t_hash hash; B.getData(raw_B, 32, 4, false); sha1_hash(&hash, 32, raw_B); scrambler = *(t_uint32*)hash; return BigInt(scrambler); }
static void ONVIF_GenrateDigest(unsigned char *pwddigest_out, unsigned char *pwd, char *nonc, char *time) { const unsigned char *tdist; unsigned char dist[1024] = {0}; char tmp[1024] = {0}; unsigned char bout[1024] = {0}; strcpy(tmp,nonc); base64_64_to_bits((char*)bout, tmp); sprintf(tmp,"%s%s%s",bout,time,pwd); sha1_hash(tmp,dist); tdist = dist; memset(bout,0x0,1024); base64_bits_to_64(bout,tdist,(int)strlen((const char*)tdist)); strcpy((char *)pwddigest_out,(const char*)bout); }
/* compute and output the MAC value */ void hmac_sha1_end(unsigned char mac[], unsigned long mac_len, hmac_ctx cx[1]) { unsigned char dig[OUT_BLOCK_LENGTH]; unsigned int i; /* if no data has been entered perform a null data phase */ if(cx->klen != HMAC_IN_DATA) hmac_sha1_data((const unsigned char*)0, 0, cx); sha1_end(dig, cx->ctx); /* complete the inner hash */ /* set outer key value using opad and removing ipad */ for(i = 0; i < IN_BLOCK_LENGTH / sizeof(ARCH_WORD_32); ++i) cx->key[i] ^= 0x36363636 ^ 0x5c5c5c5c; /* perform the outer hash operation */ sha1_begin(cx->ctx); sha1_hash(cx->key, IN_BLOCK_LENGTH, cx->ctx); sha1_hash(dig, OUT_BLOCK_LENGTH, cx->ctx); sha1_end(dig, cx->ctx); /* output the hash value */ for(i = 0; i < mac_len; ++i) mac[i] = dig[i]; }
int main(void){ const char message[] = "abcdefghbcdefghicdefghijdefghijkefghijklfghijklmghijklmnhijklmnoijklmnopjklmnopqklmnopqrlmnopqrsmnopqrstnopqrstu"; uint32_t hash[SHA1_HASH_NB_DWORD]; struct sha1State state; sha1_init(&state); sha1_feed(&state, (const uint32_t*)message, strlen(message)); sha1_hash(&state, hash); printf("Plaintext: \"%s\"\n", message); printf("SHA1 hash: "); fprintBuffer_raw(stdout, (char*)hash, SHA1_HASH_NB_BYTE); putchar('\n'); return EXIT_SUCCESS; }
char* proxy_cache(char* input_url, char* h_path, int semid) { umask(000); //set permission umask(000) char homedir[30]; char hash_url[41]; //hashed URL int check = 0; //check variable struct dirent *pFile; //declare dirent DIR *pDir; //declare DIR strcpy(h_path, getHomeDir(homedir)); strcat(h_path, "/proxy_cache"); //attach "/proxy_cache" after home directory mkdir(h_path, S_IRWXU | S_IRWXG | S_IRWXO); //make proxy_cache directory sha1_hash(input_url, hash_url); //convert input_url to hashed URL strncat(h_path, "/",1); //attach "/" to h_path strncat(h_path, hash_url,1); //attach hash_url[0] to h_path //current h_path = "home directory/proxy_cache/hash_url[0]" mkdir(h_path, S_IRWXU | S_IRWXG | S_IRWXO); //make h_path directory strncat(h_path, "/",1); //attach "/' to h_path strncat(h_path,&hash_url[1], 1); //attach hash_url[1] to h_path //current h_path = "home directory/proxy_cache/hash_url[0]/hash_url[1]" check=mkdir(h_path, S_IRWXU | S_IRWXG | S_IRWXO); //make h_path directory if(check==-1){ //only in case h_path aleady exist, to read file is executed. pDir=opendir(h_path); //pDir = h_path directory for(pFile=readdir(pDir); pFile; pFile=readdir(pDir)){ //check same name file to already exist( if(strcmp(pFile->d_name, &hash_url[2])==0){ //compare files in h_pat with hash_url[2]~end //!HIT! //print hash_url, local time in "logfile" print_logfile(1, semid, hash_url); check=1; //if same check ==1? HIT break; } } closedir(pDir); //close directory } strncat(h_path, "/",1); //attach "/" to h_path strcat(h_path, &hash_url[2]); //current h_path="home directory/proxy_cache/hash_url[0]/hash_url[1]/hash_url[2]~end" return h_path; }
bool fips186_gen::gen_p (bigint *p, const bigint &q, u_int iter) { bigint X, c; for (u_int i = 0; i < num_p_candidates; i++) { for (u_int off = 0; off < raw_psize; off += HASHSIZE) { seed[0]++; sha1_hash (raw_p + off, seed, seedsize << 3); // seedsize * 8 } mpz_set_rawmag_le (&X, raw_p, pbytes); mpz_setbit (&X, pbits - 1); c = X; c = mod (c, q * 2); *p = (X - c + 1); if (p->probab_prime (iter)) return true; } return false; }
static void create_hash(char hash_str[SHA1_RESULT_LEN*2 + 1], const char *pInput) { unsigned char hash_bytes[SHA1_RESULT_LEN]; sha1_ctx_t sha1ctx; sha1_begin(&sha1ctx); sha1_hash(&sha1ctx, pInput, strlen(pInput)); sha1_end(&sha1ctx, hash_bytes); unsigned len = SHA1_RESULT_LEN; unsigned char *s = hash_bytes; char *d = hash_str; while (len) { *d++ = "0123456789abcdef"[*s >> 4]; *d++ = "0123456789abcdef"[*s & 0xf]; s++; len--; } *d = '\0'; //log("hash:%s str:'%s'", hash_str, pInput); }
void UpdateDialog::next_file_update(QNetworkReply* r){ if(r != NULL){ if(r->error()== QNetworkReply::NoError){ ui->progress_text->setText(ui->progress_text->toPlainText() +"\n"+tr("Download finished")); QString fp = downloadfile_list[current_file]->canonicalFilePath(); QFile f(fp.left(fp.lastIndexOf(".update"))); int lioSlash = fp.lastIndexOf("/"); if(lioSlash>=0){ QDir().mkpath(fp.left(lioSlash)); } QByteArray a = r->readAll(); QCryptographicHash md5_hash(QCryptographicHash::Md5); md5_hash.addData(a); QCryptographicHash sha1_hash(QCryptographicHash::Sha1); sha1_hash.addData(a); if(sha1_hash.result().toHex().toUpper() == downloadfile_list[current_file]->sha1Hash().toUpper() && md5_hash.result().toHex().toUpper() == downloadfile_list[current_file]->md5Hash().toUpper()){ f.open(QFile::WriteOnly); f.write(a); }else{ ui->progress_text->setText(ui->progress_text->toPlainText() +"\n"+tr("Installation failure") ); ui->progress_text->verticalScrollBar()->setValue(ui->progress_text->verticalScrollBar()->maximum()); } }else{ ui->error_dl_label->setText(r->errorString()); ui->progress_text->setText(ui->progress_text->toPlainText() +"\n"+tr("Download error")+r->errorString() ); ui->progress_text->verticalScrollBar()->setValue(ui->progress_text->verticalScrollBar()->maximum()); } } current_file++; if(current_file >= downloadfile_list.length()){ ui->nextButton->setEnabled(true); return; } ui->progress_text->setText(ui->progress_text->toPlainText() +"\n"+tr("Download: ")+repositories_list[current_repo_index]+downloadfile_list[current_file]->canonicalFilePath() ); ui->progress_text->verticalScrollBar()->setValue(ui->progress_text->verticalScrollBar()->maximum()); ui->current_download_filename->setText(tr("Download: ")+repositories_list[current_repo_index]+downloadfile_list[current_file]->canonicalFilePath()); QNetworkReply* i = dl_manager.post(QNetworkRequest(QUrl(repositories_list[current_repo_index]+downloadfile_list[current_file]->canonicalFilePath())),""); connect(i,SIGNAL(downloadProgress(qint64,qint64)),this,SLOT(file_update_progress(qint64,qint64))); ui->total_progress->setValue(current_file); }
torrent_info const& torrent_handle::get_torrent_info() const { INVARIANT_CHECK; #ifdef BOOST_NO_EXCEPTIONS const static torrent_info empty(sha1_hash(0)); #endif boost::shared_ptr<torrent> t = m_torrent.lock(); if (!t) #ifdef BOOST_NO_EXCEPTIONS return empty; #else throw_invalid_handle(); #endif session_impl::mutex_t::scoped_lock l(t->session().m_mutex); if (!t->valid_metadata()) #ifdef BOOST_NO_EXCEPTIONS return empty; #else throw_invalid_handle(); #endif return t->torrent_file(); }
void CalcFileHashesTask::run() { QByteArray buffer; const int buff_size = 65536; QCryptographicHash md5_hash(QCryptographicHash::Md5); QCryptographicHash sha1_hash(QCryptographicHash::Sha1); QCryptographicHash sha256_hash(QCryptographicHash::Sha256); qDebug() << "CalcFileHashesTask::run thread " << QThread::currentThread(); buffer.resize(buff_size); if (!file) { return; } if(!file->open(QIODevice::ReadOnly)) { // error opening qDebug() << "CalcFileHashesTask Error opening file " << file->error(); file->SetState(kErrorAccess); return; } QCryptographicHash cryptoHash(QCryptographicHash::Md5); while(!file->atEnd()){ buffer = file->read(buff_size); md5_hash.addData(buffer); sha1_hash.addData(buffer); sha256_hash.addData(buffer); } file->SetMd5(md5_hash.result()); file->SetSha1(sha1_hash.result()); file->SetSha256(sha256_hash.result()); file->close(); file->SetState(kHashesCalculated); // mark done }
static foreign_t pl_sha_hash_ctx(term_t old_ctx, term_t from, term_t new_ctx, term_t hash) { char *data; size_t datalen; struct context *cp; size_t clen; unsigned char hval[SHA2_MAX_DIGEST_SIZE]; if ( !PL_get_nchars(from, &datalen, &data, CVT_ATOM|CVT_STRING|CVT_LIST|CVT_EXCEPTION) ) return FALSE; if ( !PL_get_string_chars(old_ctx, (char **)&cp, &clen) ) return FALSE; if ( clen != sizeof (*cp) || cp->magic != CONTEXT_MAGIC ) { return pl_error(NULL, 0, "Invalid OldContext passed", ERR_DOMAIN, old_ctx, "algorithm"); } if ( cp->opts.algorithm == ALGORITHM_SHA1 ) { sha1_ctx *c1p = &(cp->context.sha1); sha1_hash((unsigned char*)data, (unsigned long)datalen, c1p); if ( !PL_unify_string_nchars(new_ctx, sizeof(*cp), (char*)cp) ) return FALSE; sha1_end((unsigned char *)hval, c1p); } else { sha2_ctx *c1p = &(cp->context.sha2); sha2_hash((unsigned char*)data, (unsigned long)datalen, c1p); if ( !PL_unify_string_nchars(new_ctx, sizeof(*cp), (char*)cp) ) return FALSE; sha2_end((unsigned char *)hval, c1p); } /* . */ return PL_unify_list_ncodes(hash, cp->opts.digest_size, (char*)hval); }
std::string vmsHash::Hash_SHA1(LPCSTR pszFile) { sha1_ctx sha1; vmsFile file; __int64 trb = 0; BYTE abBuf [16000]; sha1_begin (&sha1); try { file.Open (pszFile, TRUE); __int64 uSize = file.get_Size (); DWORD dwRead; while (dwRead = file.Read (abBuf, sizeof (abBuf))) { sha1_hash (abBuf, dwRead, &sha1); trb += dwRead; if (m_pEvents) { double f = (double)trb / uSize * 100; if (false == m_pEvents->OnProgressChanged (f)) { trb = 0; break; } } } BYTE abRes [256]; sha1_end (abRes, &sha1); if (trb == 0 && uSize != 0) return ""; return Hash_ResultToStr (abRes, 20); }catch (...) {return "";} }
static int self_check() { uint32_t hash[5]; sha1_hash((uint8_t*)"", 0, hash); if (hash[0]!=0xDA39A3EE||hash[1]!=0x5E6B4B0D||hash[2]!=0x3255BFEF||hash[3]!=0x95601890||hash[4]!=0xAFD80709) return 0; sha1_hash((uint8_t*)"a", 1, hash); if (hash[0]!=0x86F7E437||hash[1]!=0xFAA5A7FC||hash[2]!=0xE15D1DDC||hash[3]!=0xB9EAEAEA||hash[4]!=0x377667B8) return 0; sha1_hash((uint8_t*)"abc", 3, hash); if (hash[0]!=0xA9993E36||hash[1]!=0x4706816A||hash[2]!=0xBA3E2571||hash[3]!=0x7850C26C||hash[4]!=0x9CD0D89D) return 0; sha1_hash((uint8_t*)"message digest", 14, hash); if (hash[0]!=0xC12252CE||hash[1]!=0xDA8BE899||hash[2]!=0x4D5FA029||hash[3]!=0x0A47231C||hash[4]!=0x1D16AAE3) return 0; sha1_hash((uint8_t*)"abcdefghijklmnopqrstuvwxyz", 26, hash); if (hash[0]!=0x32D10C7B||hash[1]!=0x8CF96570||hash[2]!=0xCA04CE37||hash[3]!=0xF2A19D84||hash[4]!=0x240D3A89) return 0; sha1_hash((uint8_t*)"abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq", 56, hash); if (hash[0]!=0x84983E44||hash[1]!=0x1C3BD26E||hash[2]!=0xBAAE4AA1||hash[3]!=0xF95129E5||hash[4]!=0xE54670F1) return 0; return 1; }
inline Sha1 sha1_hash(const std::string &str){ return sha1_hash(str.data(), str.size()); }
inline Sha1 sha1_hash(const char *str){ return sha1_hash(str, std::strlen(str)); }
int cloakhost(char *host, char *dest) { char virt[HOSTLEN + 1], ip6buffer[INET6_ADDRSTRLEN], *p; unsigned int dotCount, colCount; int32_t csum; host_type_t htype; htype = host_type(host, &dotCount, &colCount); memset(virt, 0x0, HOSTLEN+1); switch (htype) { case HT_INVALID: return 0; case HT_FQDN: csum = fnv_hash(sha1_hash(host, strlen(host)), SHABUFLEN); if (dotCount == 1) { snprintf(virt, HOSTLEN, "%s%c%X.%s", cloak_host, (csum < 0 ? '=' : '-'), (csum < 0 ? -csum : csum), host); } else if (dotCount > 1) { int chlen = strlen(cloak_host) + 10; /* -12345678. */ p = (char *) strchr((char *)host, '.'); while((strlen(p) + chlen) > HOSTLEN) { /* controllare i return value non sarebbe una cattiva idea... */ if ((p = (char *) strchr((char *) ++p, '.')) == NULL) return 0; } snprintf(virt, HOSTLEN, "%s%c%X.%s", cloak_host, (csum < 0 ? '=' : '-'), (csum < 0 ? -csum : csum), p + 1); } else return 0; break; case HT_IPv4: { char ipmask[16]; csum = fnv_hash(sha1_hash(host, strlen(host)), SHABUFLEN); strncpy(ipmask, host, sizeof(ipmask)); ipmask[sizeof(ipmask) - 1] = '\0'; if ((p = strchr(ipmask, '.')) != NULL) if ((p = strchr(p + 1, '.')) != NULL) *p = '\0'; if (p == NULL) snprintf(virt, HOSTLEN, "%s%c%X", cloak_host, csum < 0 ? '=' : '-', csum < 0 ? -csum : csum); else snprintf(virt, HOSTLEN, "%s.%s%c%X", ipmask, cloak_host, csum < 0 ? '=' : '-', csum < 0 ? -csum : csum); break; } case HT_IPv6: { /* FFFFFFFUUUUUUUU */ int rv; struct in6_addr ip6addr; /* Expand address before hashing */ expand_ipv6(host, colCount, ip6buffer); Debug((DEBUG_INFO, "%s expanded to %s (%u columns)", host, ip6buffer, colCount)); csum = fnv_hash(sha1_hash(ip6buffer, strlen(ip6buffer)), SHABUFLEN); /* Clear the buffer */ memset(ip6buffer, 0, sizeof(ip6buffer)); /* Get raw bytes... */ rv = inet_pton(AF_INET6, host, &ip6addr); if (rv <= 0) { Debug((DEBUG_ERROR, "inet_pton failed: rv = %d, errno = %d", rv, errno)); return 0; } /* ...blank out the lowest 80 bits... */ memset(&(ip6addr.s6_addr[6]), 0, 10); /* ...and get back the "presentation format" */ if (inet_ntop(AF_INET6, &ip6addr, ip6buffer, INET6_ADDRSTRLEN) == NULL) { Debug((DEBUG_ERROR, "inet_ntop failed: errno = %d", errno)); return 0; } /* Now append the checksum (eg. "2001:db8::Azzurra-12345678") */ snprintf(virt, HOSTLEN, "%s%s%c%X", ip6buffer, cloak_host, csum < 0 ? '=' : '-', csum < 0 ? -csum : csum); break; } } memcpy(dest, virt, HOSTLEN); return 1; }
char * cloak_key_checksum(void) { return(sha1_hash(cloak_key, cloak_key_len)); }