]> git.rkrishnan.org Git - tahoe-lafs/zfec.git/blobdiff - zfec/zfec/easyfec.py
stick a .gitignore file
[tahoe-lafs/zfec.git] / zfec / zfec / easyfec.py
index db39f5bf71f699064125bf611dbffbe019ef418f..dd209e788d7602dd5dd69fcefd13e89d124fc237 100644 (file)
@@ -10,6 +10,17 @@ def div_ceil(n, d):
     """
     return (n/d) + (n%d != 0)
 
+from base64 import b32encode
+def ab(x): # debuggery
+    if len(x) >= 3:
+        return "%s:%s" % (len(x), b32encode(x[-3:]),)
+    elif len(x) == 2:
+        return "%s:%s" % (len(x), b32encode(x[-2:]),)
+    elif len(x) == 1:
+        return "%s:%s" % (len(x), b32encode(x[-1:]),)
+    elif len(x) == 0:
+        return "%s:%s" % (len(x), "--empty--",)
+
 class Encoder(object):
     def __init__(self, k, m):
         self.fec = zfec.Encoder(k, m)
@@ -49,15 +60,5 @@ class Decoder(object):
 # Author: Zooko Wilcox-O'Hearn
 # 
 # This file is part of zfec.
-#
-# 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, with the added permission that, if you become obligated
-# to release a derived work under this licence (as per section 2.b), you may
-# delay the fulfillment of this obligation for up to 12 months.  See the file
-# COPYING for details.
-#
-# If you would like to inquire about a commercial relationship with Allmydata,
-# Inc., please contact partnerships@allmydata.com and visit
-# http://allmydata.com/.
+# 
+# See README.rst for licensing information.