diff options
author | Yohann Ferreira <bertram@cegetel.net> | 2008-04-21 16:23:56 +0000 |
---|---|---|
committer | Yohann Ferreira <bertram@cegetel.net> | 2008-04-21 16:23:56 +0000 |
commit | 5a341534a7de64c2a83ca06d594b982f373d7a1b (patch) | |
tree | 2f46da8c1d76f01c3e113f0b06cf5f273ea59846 /src/utils/encryption.h | |
parent | 220f58528e5ae82203952de6a6df4855519917f4 (diff) | |
download | manaserv-5a341534a7de64c2a83ca06d594b982f373d7a1b.tar.gz manaserv-5a341534a7de64c2a83ca06d594b982f373d7a1b.tar.bz2 manaserv-5a341534a7de64c2a83ca06d594b982f373d7a1b.tar.xz manaserv-5a341534a7de64c2a83ca06d594b982f373d7a1b.zip |
Added password and email encryption server-side using SHA256.
Diffstat (limited to 'src/utils/encryption.h')
-rw-r--r-- | src/utils/encryption.h | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/src/utils/encryption.h b/src/utils/encryption.h new file mode 100644 index 00000000..0a1538db --- /dev/null +++ b/src/utils/encryption.h @@ -0,0 +1,49 @@ +/*
+ * The Mana World
+ * Copyright 2008 The Mana World Development Team
+ *
+ * This file is part of The Mana World.
+ *
+ * The Mana World is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * any later version.
+ *
+ * The Mana World is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with The Mana World; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ * $Id: $
+ */
+
+#ifndef _TMW_UTILS_ENCRYPTION_H
+#define _TMW_UTILS_ENCRYPTION_H
+
+#include <string>
+
+#include "sha2.h"
+
+namespace Encryption {
+
+/** SHA256 Encryption related */
+const char SHA256HashLength = 64;
+
+/** Set the encryption strength */
+const sha2::SHA_TYPE shaType = sha2::enuSHA256;
+
+/** Create an SHA2 hash from a given string */
+std::string GetSHA2Hash(std::string stringToHash);
+
+/** Create a random string, suitable for a user to type,
+ * and that doesn't break a database */
+std::string CreateRandomPassword();
+
+}
+
+#endif //TMW_UTILS_ENCRYPTION_H
+
|