commit x64 compilation from lulu cause the other branch dont seems to compile properly at home
This commit is contained in:
47
include/platform/hash/nsha1.cpp
Normal file
47
include/platform/hash/nsha1.cpp
Normal file
@ -0,0 +1,47 @@
|
||||
/* -----------------------------------------------------------------------------
|
||||
GSFramework
|
||||
Copyright 2001-2013 Emmanuel Julien. All Rights Reserved.
|
||||
----------------------------------------------------------------------------- */
|
||||
|
||||
|
||||
#include "hash/nsha1.h"
|
||||
#include "hash/sha1.h"
|
||||
#include "container/narray.h"
|
||||
#include "nstring/nstring.h"
|
||||
|
||||
using namespace GS;
|
||||
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
void SHA1::ComputeHash(const String &source, Array <unsigned char> &hash)
|
||||
{
|
||||
if (hash.Allocate(20))
|
||||
sha1::calc(source.c_str(), source.Len(), hash.c_ptr());
|
||||
}
|
||||
String SHA1::ComputeHexa(const String &source)
|
||||
{
|
||||
Array <unsigned char> hash;
|
||||
ComputeHash(source, hash);
|
||||
|
||||
char hex[41];
|
||||
sha1::toHexString(hash.c_ptr(), hex);
|
||||
return String(hex);
|
||||
}
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
void SHA1::ComputeHash(const Array <char> &data, Array <unsigned char> &hash)
|
||||
{
|
||||
if (hash.Allocate(20))
|
||||
sha1::calc(data.c_ptr(), data.GetSize(), hash.c_ptr());
|
||||
}
|
||||
String SHA1::ComputeHexa(const Array <char> &data)
|
||||
{
|
||||
Array <unsigned char> hash;
|
||||
ComputeHash(data, hash);
|
||||
|
||||
char hex[41];
|
||||
sha1::toHexString(hash.c_ptr(), hex);
|
||||
return String(hex);
|
||||
}
|
||||
//------------------------------------------------------------------------------
|
||||
Reference in New Issue
Block a user