Skip to content

Commit

Permalink
Change from tranquilty to that (#74)
Browse files Browse the repository at this point in the history
  • Loading branch information
kojiwell committed Apr 25, 2022
1 parent 78dbea7 commit 0e10ea1
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions src/trops/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,9 @@ def yes_or_no(question):
return False


def tranquility():
def that():
"""Tribute to this.py and Laozi"""
s = """\
Tao Te Ching / Chapter 45
s = """Tao Te Ching / Chapter 45
Great support seems deficient,
Employed it will not collapse;
Great buoyancy seems empty,
Expand All @@ -47,13 +46,12 @@ def tranquility():

def generate_sid(args, other_args):
"""Generate a session ID"""
s = tranquility()
# Three is a magic number
s = that()
# Three and seven are magic numbers
hlen = 3
tlen = 4
n = randint(0, len(s)-hlen)
now = datetime.now().isoformat()
head = ''.join(list(s)[n:n+hlen]).lower()
tail = hashlib.sha256(bytes(now, 'utf-8')).hexdigest()[0:tlen]
# Seven is also a magic number
print(head + tail)

0 comments on commit 0e10ea1

Please sign in to comment.