/[gzz]/manuscripts/Sigs/poss.py
ViewVC logotype

Diff of /manuscripts/Sigs/poss.py

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.10 by tjl, Mon May 19 13:18:32 2003 UTC revision 1.11 by tjl, Mon May 19 13:35:54 2003 UTC
# Line 45  def merkle_hashtree(n, S): Line 45  def merkle_hashtree(n, S):
45                  S[4],                  S[4],
46                  S[4],                  S[4],
47                  2L**n * S[5] + 2L**(n+1) - 1,                  2L**n * S[5] + 2L**(n+1) - 1,
48                  S[6] + n,                  S[6],
49                  S[7] + n)                  S[7] + n + 1)
50    
51  def key_boosting(N, S):  def key_boosting(N, S):
52      return (S[0] ** N,      return (S[0] ** N,
# Line 116  if __name__ == '__main__': Line 116  if __name__ == '__main__':
116    
117      if 1:      if 1:
118    
119          def pzip(names, arrs):          def pzip(names, arrs, zeros):
120              res = []              res = []
121              for i in range(0, len(arrs[0])):              for i in range(0, len(arrs[0])):
122                  res.append(" + ".join([                  s = [
123                          "%s %s" % (arrs[name][i], names[name])                          "%s %s" % (arrs[name][i]-zeros[i], names[name])
124                      for name in range(0, len(names))                      for name in range(0, len(names))
125                          if arrs[name][i] != 0]))                          if arrs[name][i]-zeros[i] != 0]
126                    if(zeros[i] != 0):
127                        s.append(" %s" % zeros[i])
128                    s = " + ".join(s)
129                    res.append(s)
130              return res              return res
131                    
132          for N,n in tks:          for N,n in tks:
133                z = key_boosting(N,
134                 merkle_hashtree(n,
135                  (0, 0, 0, 0, 0, 0, 0, 0)))
136              ss = key_boosting(N,              ss = key_boosting(N,
137               merkle_hashtree(n,               merkle_hashtree(n,
138                (0, 0, 1, 0, 0, 0, 0, 0)))                (0, 0, 1, 0, 0, 0, 0, 0)))
# Line 145  if __name__ == '__main__': Line 152  if __name__ == '__main__':
152               merkle_hashtree(n,               merkle_hashtree(n,
153                (0, 0, 0, 0, 0, 0, 0, 1)))                (0, 0, 0, 0, 0, 0, 0, 1)))
154              print "\n\n",N,n              print "\n\n",N,n
155              print "S,R:", pzip(("s'", "r'", "h'"), (ss, sr, sh)) [2:4]              print "S,R:", pzip(("s'", "r'", "h'"), (ss, sr, sh), z) [2:4]
156              print "C0,Cs,Cv:", pzip(("C0'", "Cs'", "Cv'"), (sc0, scs, scv)) [5:]              print "C0,Cs,Cv:", pzip(("C0'", "Cs'", "Cv'"), (sc0, scs, scv), z) [5:]
157    
158    
159    

Legend:
Removed from v.1.10  
changed lines
  Added in v.1.11

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26