mirror of
https://github.com/anope/anope.git
synced 2026-06-29 18:56:37 +02:00
fixed enc_sha256
This commit is contained in:
@@ -1296,3 +1296,26 @@ bool str_is_cidr(const Anope::string &str, uint32 &ip, uint32 &mask, Anope::stri
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/********************************************************************************/
|
||||
|
||||
/** Converts a string to hex
|
||||
* @param the data to be converted
|
||||
* @return a anope::string containing the hex value
|
||||
*/
|
||||
|
||||
Anope::string Anope::Hex(const Anope::string &data)
|
||||
{
|
||||
const char hextable[] = "0123456789abcdef";
|
||||
|
||||
int l = data.length();
|
||||
Anope::string rv;
|
||||
for(int i=0; i < l; i++)
|
||||
{
|
||||
unsigned char c = data[i];
|
||||
rv += hextable[c >> 4];
|
||||
rv += hextable[c & 0xF];
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user