summaryrefslogtreecommitdiff
path: root/addons/base_crypt/crypt.py
diff options
context:
space:
mode:
authorHusen Daudi <hda@tinyerp.com>2008-05-29 04:46:07 +0000
committerVo Minh Thu <vmt@openerp.com>2008-05-29 04:46:07 +0000
commite830358b25b74430c8bceb3e724f774d440a09d1 (patch)
tree4de73bc8fd2444f75b0ba82d5c8d2209f9a6cdac /addons/base_crypt/crypt.py
parentb495cec9d12666240ff4d8a31dc3ec0b97dcbcaf (diff)
Add copyrights
bzr revid: hda@tinyerp.com-20080529044607-09pqwt6ihm3j62go
Diffstat (limited to 'addons/base_crypt/crypt.py')
-rw-r--r--addons/base_crypt/crypt.py54
1 files changed, 54 insertions, 0 deletions
diff --git a/addons/base_crypt/crypt.py b/addons/base_crypt/crypt.py
index 1d461463a27..7d2ab0e8cf7 100644
--- a/addons/base_crypt/crypt.py
+++ b/addons/base_crypt/crypt.py
@@ -1,3 +1,41 @@
+# Notice:
+# ------
+#
+# Implements encrypting functions.
+#
+# Copyright (c) 2008, F S 3 Consulting Inc.
+#
+# Maintainer:
+# Alec Joseph Rivera (agi<at>fs3.ph)
+#
+#
+# Warning:
+# -------
+#
+# This program as such is intended to be used by professional programmers
+# who take the whole responsibility of assessing all potential consequences
+# resulting from its eventual inadequacies and bugs. End users who are
+# looking for a ready-to-use solution with commercial guarantees and
+# support are strongly adviced to contract a Free Software Service Company.
+#
+# This program 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 (at your
+# option) any later version.
+#
+# This program 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 this program; if not, write to the:
+#
+# Free Software Foundation, Inc.
+# 59 Temple Place - Suite 330
+# Boston, MA 02111-1307
+# USA.
+
from random import seed, sample
from string import letters, digits
from osv import fields,osv
@@ -11,6 +49,22 @@ def gen_salt( length=8, symbols=letters + digits ):
seed()
return ''.join( sample( symbols, length ) )
+# The encrypt_md5 is based on Mark Johnson's md5crypt.py, which in turn is
+# based on FreeBSD src/lib/libcrypt/crypt.c (1.2) by Poul-Henning Kamp.
+# Mark's port can be found in ActiveState ASPN Python Cookbook. Kudos to
+# Poul and Mark. -agi
+#
+# Original license:
+#
+# * "THE BEER-WARE LICENSE" (Revision 42):
+# *
+# * <phk@login.dknet.dk> wrote this file. As long as you retain this
+# * notice you can do whatever you want with this stuff. If we meet some
+# * day, and you think this stuff is worth it, you can buy me a beer in
+# * return.
+# *
+# * Poul-Henning Kamp
+
import md5
def encrypt_md5( raw_pw, salt, magic=magic_md5 ):