mirror of
https://github.com/cedricbonhomme/Stegano.git
synced 2025-05-12 17:18:30 +02:00
the command line now uses the crayons Python library in order to have colored strings in the terminal.
This commit is contained in:
parent
263e287559
commit
6215c03939
4 changed files with 25 additions and 26 deletions
|
@ -1,6 +1,12 @@
|
||||||
Release History
|
Release History
|
||||||
===============
|
===============
|
||||||
|
|
||||||
|
0.6.6 (2017-02-20)
|
||||||
|
------------------
|
||||||
|
|
||||||
|
* improved docstrings for the desciption of the generators;
|
||||||
|
* improved the command which displays the list of generators.
|
||||||
|
|
||||||
0.6.5 (2017-02-16)
|
0.6.5 (2017-02-16)
|
||||||
------------------
|
------------------
|
||||||
|
|
||||||
|
|
|
@ -25,6 +25,8 @@ __date__ = "$Date: 2016/03/18 $"
|
||||||
__revision__ = "$Date: 2016/08/04 $"
|
__revision__ = "$Date: 2016/08/04 $"
|
||||||
__license__ = "GPLv3"
|
__license__ = "GPLv3"
|
||||||
|
|
||||||
|
import crayons
|
||||||
|
|
||||||
try:
|
try:
|
||||||
from stegano import lsbset
|
from stegano import lsbset
|
||||||
from stegano.lsbset import generators
|
from stegano.lsbset import generators
|
||||||
|
@ -120,4 +122,7 @@ elif arguments.command == 'list-generators':
|
||||||
import inspect
|
import inspect
|
||||||
all_generators = inspect.getmembers(generators, inspect.isfunction)
|
all_generators = inspect.getmembers(generators, inspect.isfunction)
|
||||||
for generator in all_generators:
|
for generator in all_generators:
|
||||||
print(generator[0], generator[1].__doc__)
|
print('Generator id:\n {}\nDesciption:\n {}'.format(
|
||||||
|
crayons.green(generator[0]),
|
||||||
|
generator[1].__doc__))
|
||||||
|
print('')
|
||||||
|
|
2
setup.py
2
setup.py
|
@ -36,7 +36,7 @@ with open('CHANGELOG.rst', 'r') as f:
|
||||||
|
|
||||||
setup(
|
setup(
|
||||||
name='Stegano',
|
name='Stegano',
|
||||||
version='0.6.5',
|
version='0.6.6',
|
||||||
author='Cédric Bonhomme',
|
author='Cédric Bonhomme',
|
||||||
author_email='cedric@cedricbonhomme.org',
|
author_email='cedric@cedricbonhomme.org',
|
||||||
packages=packages,
|
packages=packages,
|
||||||
|
|
|
@ -29,8 +29,7 @@ import math
|
||||||
import itertools
|
import itertools
|
||||||
|
|
||||||
def identity():
|
def identity():
|
||||||
"""
|
"""f(x) = x
|
||||||
f(x) = x
|
|
||||||
"""
|
"""
|
||||||
n = 0
|
n = 0
|
||||||
while True:
|
while True:
|
||||||
|
@ -38,8 +37,7 @@ def identity():
|
||||||
n += 1
|
n += 1
|
||||||
|
|
||||||
def Dead_Man_Walking():
|
def Dead_Man_Walking():
|
||||||
"""
|
"""Dead Man Walking.
|
||||||
Dead Man Walking.
|
|
||||||
"""
|
"""
|
||||||
n = 0
|
n = 0
|
||||||
while True:
|
while True:
|
||||||
|
@ -47,8 +45,7 @@ def Dead_Man_Walking():
|
||||||
n += 2
|
n += 2
|
||||||
|
|
||||||
def OEIS_A000217():
|
def OEIS_A000217():
|
||||||
"""
|
"""http://oeis.org/A000217
|
||||||
http://oeis.org/A000217
|
|
||||||
Triangular numbers: a(n) = C(n+1,2) = n(n+1)/2 = 0+1+2+...+n.
|
Triangular numbers: a(n) = C(n+1,2) = n(n+1)/2 = 0+1+2+...+n.
|
||||||
"""
|
"""
|
||||||
n = 0
|
n = 0
|
||||||
|
@ -57,8 +54,7 @@ def OEIS_A000217():
|
||||||
n += 1
|
n += 1
|
||||||
|
|
||||||
def fermat():
|
def fermat():
|
||||||
"""
|
"""Generate the n-th Fermat Number.
|
||||||
Generate the n-th Fermat Number.
|
|
||||||
"""
|
"""
|
||||||
y = 5
|
y = 5
|
||||||
while True:
|
while True:
|
||||||
|
@ -66,8 +62,7 @@ def fermat():
|
||||||
y = pow(y-1,2)+1
|
y = pow(y-1,2)+1
|
||||||
|
|
||||||
def mersenne():
|
def mersenne():
|
||||||
"""
|
"""Generate 2^n-1.
|
||||||
Generate 2^n-1.
|
|
||||||
"""
|
"""
|
||||||
y = 1
|
y = 1
|
||||||
while True:
|
while True:
|
||||||
|
@ -75,8 +70,7 @@ def mersenne():
|
||||||
y = 2*y + 1
|
y = 2*y + 1
|
||||||
|
|
||||||
def eratosthenes():
|
def eratosthenes():
|
||||||
"""
|
"""Generate the prime numbers with the sieve of Eratosthenes.
|
||||||
Generate the prime numbers with the sieve of Eratosthenes.
|
|
||||||
"""
|
"""
|
||||||
d = {}
|
d = {}
|
||||||
for i in itertools.count(2):
|
for i in itertools.count(2):
|
||||||
|
@ -89,8 +83,7 @@ def eratosthenes():
|
||||||
yield i
|
yield i
|
||||||
|
|
||||||
def eratosthenes_composite():
|
def eratosthenes_composite():
|
||||||
"""
|
"""Generate the composite numbers with the sieve of Eratosthenes.
|
||||||
Generate the composite numbers with the sieve of Eratosthenes.
|
|
||||||
"""
|
"""
|
||||||
p1 = 3
|
p1 = 3
|
||||||
for p2 in eratosthenes():
|
for p2 in eratosthenes():
|
||||||
|
@ -99,8 +92,7 @@ def eratosthenes_composite():
|
||||||
p1 = p2
|
p1 = p2
|
||||||
|
|
||||||
def carmichael():
|
def carmichael():
|
||||||
"""
|
"""https://oeis.org/A002997
|
||||||
https://oeis.org/A002997
|
|
||||||
Composite numbers n such that a^(n-1) == 1 (mod n) for every a coprime to n.
|
Composite numbers n such that a^(n-1) == 1 (mod n) for every a coprime to n.
|
||||||
"""
|
"""
|
||||||
for m in eratosthenes_composite():
|
for m in eratosthenes_composite():
|
||||||
|
@ -111,8 +103,7 @@ def carmichael():
|
||||||
yield m
|
yield m
|
||||||
|
|
||||||
def ackermann(m, n):
|
def ackermann(m, n):
|
||||||
"""
|
"""Ackermann number.
|
||||||
Ackermann number.
|
|
||||||
"""
|
"""
|
||||||
if m == 0:
|
if m == 0:
|
||||||
return n + 1
|
return n + 1
|
||||||
|
@ -122,8 +113,7 @@ def ackermann(m, n):
|
||||||
return ackermann(m - 1, ackermann(m, n - 1))
|
return ackermann(m - 1, ackermann(m, n - 1))
|
||||||
|
|
||||||
def fibonacci():
|
def fibonacci():
|
||||||
"""
|
"""https://oeis.org/A000045
|
||||||
https://oeis.org/A000045
|
|
||||||
A generator for Fibonacci numbers, goes to next number in series on each call.
|
A generator for Fibonacci numbers, goes to next number in series on each call.
|
||||||
This generator start at 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377, 610, 987, 1597, 2584, 4181, 6765, 10946, ...
|
This generator start at 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377, 610, 987, 1597, 2584, 4181, 6765, 10946, ...
|
||||||
"""
|
"""
|
||||||
|
@ -133,8 +123,7 @@ def fibonacci():
|
||||||
a, b = b, a + b
|
a, b = b, a + b
|
||||||
|
|
||||||
def syracuse(l=15):
|
def syracuse(l=15):
|
||||||
"""
|
"""Generate the sequence of Syracuse.
|
||||||
Generate the sequence of Syracuse.
|
|
||||||
"""
|
"""
|
||||||
y = l
|
y = l
|
||||||
while True:
|
while True:
|
||||||
|
@ -146,8 +135,7 @@ def syracuse(l=15):
|
||||||
y = 3*y + 1
|
y = 3*y + 1
|
||||||
|
|
||||||
def log_gen():
|
def log_gen():
|
||||||
"""
|
"""Logarithmic generator.
|
||||||
Logarithmic generator.
|
|
||||||
"""
|
"""
|
||||||
y = 1
|
y = 1
|
||||||
while True:
|
while True:
|
||||||
|
|
Loading…
Add table
Reference in a new issue