todella vähän parempi shashasha
This commit is contained in:
parent
6528b2401e
commit
dc393eecf5
26
shashasha.py
26
shashasha.py
@ -1,4 +1,8 @@
|
|||||||
#!/usr/bin/python3.10
|
#!/usr/bin/python3.10
|
||||||
|
"""
|
||||||
|
This is simple script that gives out quite random chars.
|
||||||
|
Like we almost won eurovision.
|
||||||
|
"""
|
||||||
|
|
||||||
from hashlib import sha256
|
from hashlib import sha256
|
||||||
from random import randint
|
from random import randint
|
||||||
@ -7,19 +11,21 @@ runs = 400
|
|||||||
turn = 0
|
turn = 0
|
||||||
start = "Hello There, friend!"
|
start = "Hello There, friend!"
|
||||||
|
|
||||||
|
|
||||||
def turns_and_runs(turn, input, end):
|
def turns_and_runs(turn, input, end):
|
||||||
input_bytes = input.encode()
|
input_bytes = input.encode()
|
||||||
input_hash = sha256(input_bytes)
|
input_hash = sha256(input_bytes)
|
||||||
return_blob = input_hash.hexdigest()
|
return_blob = input_hash.hexdigest()
|
||||||
|
|
||||||
if turn < runs:
|
if turn < runs:
|
||||||
my_random = randint(10, 60)
|
my_random = randint(10, 60)
|
||||||
end += return_blob[my_random]
|
end += return_blob[my_random]
|
||||||
return_blob = return_blob + return_blob + str(my_random)
|
return_blob = return_blob + return_blob + str(my_random)
|
||||||
end = turns_and_runs(turn + 1, return_blob, end)
|
end = turns_and_runs(turn + 1, return_blob, end)
|
||||||
|
|
||||||
return end
|
return end
|
||||||
|
|
||||||
result = turns_and_runs(turn, start, '')
|
|
||||||
|
result = turns_and_runs(turn, start, "")
|
||||||
|
|
||||||
print(result)
|
print(result)
|
||||||
|
Loading…
Reference in New Issue
Block a user