1 """Utility library for handling 32-bit unsigner integers."""
2
3
4
5 """
6 From: "Dmitry Rozmanov" <dima@xenon.spb.ru>
7 To: "Tommi Virtanen" <tv@debian.org>
8 Subject: Re: About your md4.py
9
10 Hi.
11
12 Year, I am thinking of this, but could not find time for this. Thanks for
13 the link.
14
15 But why?
16
17 Consider it as a GPL for now if it is important.
18
19 Regards.
20
21 ---Dmitry.
22
23 ----- Original Message -----
24 From: "Tommi Virtanen" <tv@debian.org>
25 To: "Dmitry Rozmanov" <dima@xenon.spb.ru>
26 Sent: Tuesday, August 27, 2002 9:17 PM
27 Subject: About your md4.py
28
29
30 > Hi. Could you consider adding a license
31 > in your U32.py and md4.py files? Here's
32 > a quick reference:
33 >
34 > http://zooko.com/license_quick_ref.html
35 >
36 > --
37 > :(){ :|:&};:
38 """
39
40 """
41 From: "Dmitry Rozmanov" <dima@xenon.spb.ru>
42 To: "Tommi Virtanen" <tv@debian.org>
43 Subject: Re: About your md4.py
44
45 Ok. Let it be LGPL. Use libs, soon I will modify them and post to the site.
46
47 Regards.
48
49 ---Dmitry.
50
51 ----- Original Message -----
52 From: "Tommi Virtanen" <tv@debian.org>
53 To: "Dmitry Rozmanov" <dima@xenon.spb.ru>
54 Sent: Wednesday, August 28, 2002 9:21 AM
55 Subject: Re: About your md4.py
56
57
58 > On Wed, Aug 28, 2002 at 02:56:25AM +0400, Dmitry Rozmanov wrote:
59 > > Year, I am thinking of this, but could not find time for
60 > > this. Thanks for the link.
61 > >
62 > > But why?
63 > >
64 > > Consider it as a GPL for now if it is important.
65 >
66 > Please include that information in the files themselves;
67 > it would really help. Otherwise, all I have is this
68 > email to point to.
69 >
70 > Oh, and please reconsider the actual license. For example,
71 > I have an LGPL'ed library I need md4 in. If you choose GPL,
72 > my library couldn't use your md4.py.
73 >
74 > --
75 > :(){ :|:&};:
76 """
77
78 C = 0x1000000000L
79
81 return n & 0xFFFFFFFFL
82
83
85 v = 0L
86
89
90 - def set(self, value = 0):
92
94 return hex(norm(self.v))
95
99
101 r = U32()
102 r.v = C + norm(self.v + b.v)
103 return r
104
106 r = U32()
107 if self.v < b.v:
108 r.v = C + norm(0x100000000L - (b.v - self.v))
109 else: r.v = C + norm(self.v - b.v)
110 return r
111
113 r = U32()
114 r.v = C + norm(self.v * b.v)
115 return r
116
121
126
130
132 r = U32()
133 r.v = C + norm(~self.v)
134 return r
135
137 r = U32()
138 r.v = C + norm(self.v << b)
139 return r
140
142 r = U32()
143 r.v = C + (norm(self.v) >> b)
144 return r
145
147 r = U32()
148 r.v = C + norm(self.v & b.v)
149 return r
150
152 r = U32()
153 r.v = C + norm(self.v | b.v)
154 return r
155
157 r = U32()
158 r.v = C + norm(self.v ^ b.v)
159 return r
160
163
166
168 if norm(self.v) > norm(b.v): return 1
169 elif norm(self.v) < norm(b.v): return -1
170 else: return 0
171
174