MCPcopy Create free account
hub / github.com/DFHack/dfhack / hashit

Method hashit

depends/md5/md5wrapper.cpp:36–51  ·  view source on GitHub ↗

* internal hash function, calling * the basic methods from md5.h */

Source from the content-addressed store, hash-verified

34 * the basic methods from md5.h
35 */
36std::string md5wrapper::hashit(unsigned char *data, size_t length)
37{
38 MD5Context ctx;
39
40 //init md5
41 MD5Init(&ctx);
42 //update with our string
43 MD5Update(&ctx, data, length);
44
45 //create the hash
46 unsigned char buff[16] = "";
47 MD5Final((unsigned char*)buff,&ctx);
48
49 //converte the hash to a string and return it
50 return convToString(buff);
51}
52
53/*
54 * converts the numeric hash to

Callers 1

getHashFromStringMethod · 0.95

Calls 3

MD5InitFunction · 0.85
MD5UpdateFunction · 0.85
MD5FinalFunction · 0.85

Tested by

no test coverage detected