I humbly announce the release of gdzip.
Gdzip is a command line tool to compress and encrypt files or folders. It is written in Go.
Executable binaries as well as the source code can be downloaded at Github:
Source code: https://github.com/w33zl3p00tch/gdzip
Releases: https://github.com/w33zl3p00tch/gdzip/releases
Internally, the given files and/or folders are compressed and stored as tar.gz archives that retain the original file metadata.
The data are split into chunks while encrypting, and encryption is done done using AES256-GCM and/or ChaCha20-Poly1305. All this happens in RAM, so no temporary files will be used.
Keys are generated using the scrypt key derivation function.
The encrypted files provide no information about their contents or their contents' filenames.
Encrypted files may be safely renamed and even the extension may be altered or left out.
Please report any bugs you might find. Suggestions and feature requests are welcome.
|\ /| scroll down for older posts.
= o.o =
= o.o =
Samstag, 3. Juni 2017
Donnerstag, 1. Juni 2017
Sieve of Eratosthenes in Python
I've recently discovered the magic of hash tables. Here is a version of the Sieve of Eratosthenes that is pretty fast, given it's written in Python:
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
# sieve returns a list of primes up to the limit n. | |
def sieve(n): | |
# a list to store prime numbers: | |
primes = [] | |
# a dictionary to store numbers that are not primes: | |
np = {} | |
for i in range(2, n+1): | |
# If i is not in the dict, it's a prime. | |
if i not in np: | |
# Store it in the list of primes. | |
primes.append(i) | |
# Add all multiples of the primes to np. | |
for j in range(i*i, n+1, i): | |
# We only need the keys, so we just store a bool as value. | |
np[j] = True | |
return primes | |
primes = sieve(100000) | |
sum = 0 | |
for i in range(len(primes)): | |
sum += primes[i] | |
print(sum) |
Abonnieren
Posts (Atom)