File: md5_hash.cpp

package info (click to toggle)
freespace2 25.0.0~rc11%2Brepack-1
  • links: PTS, VCS
  • area: non-free
  • in suites: forky, sid
  • size: 47,232 kB
  • sloc: cpp: 657,500; ansic: 22,305; sh: 293; python: 200; makefile: 198; xml: 181
file content (18 lines) | stat: -rw-r--r-- 337 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#include "md5_hash.h"

#include "globalincs/vmallocator.h"

#include "md5.h"

SCP_string md5_hash(const char* text, size_t length)
{
	MD5 md5;
	md5.update(text, static_cast<MD5::size_type>(length));
	md5.finalize();
	return md5.hexdigest();
}

SCP_string md5_hash(const SCP_string& text)
{
	return md5_hash(text.c_str(), text.size());
}