diff --git a/README.md b/README.md index 024cdd21e..ee2c02d79 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@ Decentralized websites using Bitcoin crypto and BitTorrent network - Fast and works offline: You can access the site even if your internet is gone. -## How does it works? +## How does it work? - After starting `zeronet.py` you will be able to visit zeronet sites using http://127.0.0.1:43110/{zeronet_address} (eg. http://127.0.0.1:43110/1EU1tbG9oC1A8jz2ouVwGZyQ5asrNsE4Vr). - When you visit a new zeronet site, it's trying to find peers using BitTorrent network and download the site files (html, css, js...) from them. - Each visited sites become also served by You. diff --git a/src/Crypt/CryptHash.py b/src/Crypt/CryptHash.py index e2d202a6f..57932acc0 100644 --- a/src/Crypt/CryptHash.py +++ b/src/Crypt/CryptHash.py @@ -9,10 +9,28 @@ def sha1sum(file, blocksize=65536): return hash.hexdigest() +def sha512sum(file, blocksize=65536): + if hasattr(file, "endswith"): # Its a string open it + file = open(file, "rb") + hash = hashlib.sha512() + for block in iter(lambda: file.read(blocksize), ""): + hash.update(block) + return hash.hexdigest() + + if __name__ == "__main__": import cStringIO as StringIO a = StringIO.StringIO() a.write("hello!") a.seek(0) print hashlib.sha1("hello!").hexdigest() - print sha1sum(a) \ No newline at end of file + print sha1sum(a) + + import time + s = time.time() + print sha1sum(open("F:\\Temp\\bigfile")), + print time.time()-s + + s = time.time() + print sha512sum(open("F:\\Temp\\bigfile")), + print time.time()-s \ No newline at end of file diff --git a/src/Ui/media/Loading.coffee b/src/Ui/media/Loading.coffee index 359328fed..c42ed1df4 100644 --- a/src/Ui/media/Loading.coffee +++ b/src/Ui/media/Loading.coffee @@ -12,7 +12,7 @@ class Loading # We dont need loadingscreen anymore hideScreen: -> - if not $(".loadingscreen").hasClass("done") # Nothing to do, just let the animtion to be finished + if not $(".loadingscreen").hasClass("done") # Only if its not animating already if @screen_visible # Hide with animate $(".loadingscreen").addClass("done").removeLater(2000) else # Not visible, just remove diff --git a/src/lib/BitcoinECC/BitcoinECC.py b/src/lib/BitcoinECC/BitcoinECC.py index 8ae7bea9d..6f4811328 100644 --- a/src/lib/BitcoinECC/BitcoinECC.py +++ b/src/lib/BitcoinECC/BitcoinECC.py @@ -235,7 +235,7 @@ def GeneratePrivateKey(self): #Of course, this function isn't cryptographically secure. #Don't use it to generate your key. Use a cryptographically secure source of randomness instead. #self.d = random.randint(1,self.n-1) - self.d = int(os.urandom(32).encode("hex"), 16) # Better random fix + self.d = random.SystemRandom().randint(1,self.n-1) # Better random fix def SignECDSA(self,m): #Sign a message. The private key is self.d . @@ -246,7 +246,8 @@ def SignECDSA(self,m): r=0 s=0 while not r or not s: - k=random.randint(1,self.n-1) + #k=random.randint(1,self.n-1) + k=random.SystemRandom().randint(1,self.n-1) # Better random fix R=self*k R.Normalize() r=R.x[0]%self.n