00001 from vyperlogix import oodb 00002 00003 __copyright__ = """\ 00004 (c). Copyright 1990-2008, Vyper Logix Corp., All Rights Reserved. 00005 00006 Published under Creative Commons License 00007 (http://creativecommons.org/licenses/by-nc/3.0/) 00008 restricted to non-commercial educational use only., 00009 00010 See also: http://www.VyperLogix.com and http://www.pypi.info for details. 00011 00012 THE AUTHOR VYPER LOGIX CORP DISCLAIMS ALL WARRANTIES WITH REGARD TO 00013 THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND 00014 FITNESS, IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, 00015 INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING 00016 FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, 00017 NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION 00018 WITH THE USE OR PERFORMANCE OF THIS SOFTWARE ! 00019 00020 USE AT YOUR OWN RISK. 00021 """ 00022 00023 _encode = lambda str:''.join([oodb.strToHex(chr(ord(ch))) for ch in str]) 00024 encode = lambda str:''.join([oodb.strToHex(chr(ord(ch)|128)) for ch in str]) 00025 decode = lambda str:''.join([chr(ord(ch)&127) for ch in oodb.hexToStr(str)]) 00026 _decode = lambda str:''.join([chr(ord(ch)) for ch in oodb.hexToStr(str)]) 00027 00028 _schema = [2, 1, 2, 1, 2] 00029 00030 _key = decode('F3E9F3EBEFC0B7B6B6B0A4E2B7B6B6B0')[0:16] 00031 00032 def reverseKey(key): 00033 from vyperlogix import misc 00034 00035 c_schema = misc.reverseCopy(_schema) 00036 _parts = [] 00037 _valid_until = [] 00038 toks = key.split('-') 00039 for t in toks: 00040 c = c_schema.pop() 00041 _valid_until.append(t[len(t)-c:]) 00042 _parts.append(t[0:len(t)-c]) 00043 _valid_until[1] += _valid_until[2][0] 00044 _valid_until[2] = _valid_until[2][-1] 00045 _valid_until[2] += _valid_until[3] 00046 del _valid_until[3] 00047 _valid_until[2] += _valid_until[3] 00048 del _valid_until[3] 00049 return ('-'.join(_parts),'-'.join(_valid_until)) 00050 00051 if (__name__ == '__main__'): 00052 import sys 00053 print >>sys.stdout, __copyright__ 00054 print >>sys.stderr, __copyright__ 00055 00056 00057
© Copyright 2008-2009 Vyper Logix Corp., All Right Reserved; If you reference this document or any part of this document you must use the citation verbatim (including the link) "© Copyright 2008-2009 Vyper Logix Corp., All Right Reserved."
Notice: This source code contained in this document is NOT open source and is NOT being distributed as open source.
122,241 lines of code and growing...