@@ -0,0 +1,2398 @@
+'''=========================================================================%5C%5C%5C%0A%7C%7C%7C serversquared Modification Global Backend                               %7C%7C%7C%0A%7C%7C%7C Copyright (C) 2015 Niko Geil.                                           %7C%7C%7C%0A%7C%7C%7C                                                                         %7C%7C%7C%0A%7C%7C%7C This program is free software: you can redistribute it and/or modify it %7C%7C%7C%0A%7C%7C%7C under the terms of the GNU Affero General Public License as published   %7C%7C%7C%0A%7C%7C%7C by the Free Software Foundation, either version 3 of the License, or    %7C%7C%7C%0A%7C%7C%7C (at your option) any later version.                                     %7C%7C%7C%0A%7C%7C%7C                                                                         %7C%7C%7C%0A%7C%7C%7C This program is distributed in the hope that it will be useful,         %7C%7C%7C%0A%7C%7C%7C but WITHOUT ANY WARRANTY; without even the implied warranty of          %7C%7C%7C%0A%7C%7C%7C MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the           %7C%7C%7C%0A%7C%7C%7C GNU Affero General Public License for more details.                     %7C%7C%7C%0A%7C%7C%7C                                                                         %7C%7C%7C%0A%7C%7C%7C You should have received a copy of the                                  %7C%7C%7C%0A%7C%7C%7C GNU Affero General Public License along with this program.              %7C%7C%7C%0A%7C%7C%7C If not, see %3Chttp://www.gnu.org/licenses/%3E.                             %7C%7C%7C%0A%5C%5C%5C========================================================================='''%0A%0A# Trust that hashlib is secure.%0Aimport hashlib%0Aimport random%0Aimport string%0A%0Aname = 'Password Hasher'%0Aversion = '1.0.0'%0Auses_api_version = '1.0.0'%0Auses_api_base = 1%0A%0Arandom.seed()%0Arandom.seed(''.join(random.SystemRandom().choice(string.ascii_letters + string.digits + string.punctuation)) for _ in range(64))%0A%0A# How we hash a password:%0A# %091) Generate a random string (salt).%0A# %092) Derive a key using PBKDF2.%0A# %093) Hash key with SHA-512 (for nice ASCII string storage).%0A%0Adef gen_salt(length, charset='0123456789abcdef'):%0A%09return ''.join(random.SystemRandom().choice(str(charset)) for _ in range(length))%0A%0Adef derive_key(password, salt=None, rounds=12, key=None):%0A%09if not salt:%09salt = gen_salt(128)%0A%09if key:%09%09return derive_key(password, salt, rounds)%5B0%5D == key%0A%0A%09bytes = hashlib.pbkdf2_hmac('sha512', password.encode('ascii'), salt.encode('ascii'), 2**rounds)%0A%09sha512_obj = hashlib.sha512(bytes)%0A%09digest = sha512_obj.hexdigest()%0A%09return (digest, salt, rounds)%0A

Add pass_hash library.