hashy hash

This commit is contained in:
lickthecheese 2020-03-11 11:53:05 -04:00
parent 7514694ba7
commit 6276dfea72
1 changed files with 10 additions and 3 deletions

View File

@ -1,15 +1,22 @@
#!/usr/bin/env python3
from twisted.internet import protocol, reactor, endpoints
import bcrypt
salt = b'$2b$12$mwSIOyxLJid1jFLgnU0s0.'
def hash(inp):
return bcrypt.hashpw(inp.encode('utf-8'), salt)
class Reply(protocol.Protocol):
def dataReceived(self, data):
data = str(data).split(':')
if len(data) > 3:
output = "yes"
if len(data) > 4:
data.pop(0)
output=hash(data[0])
else:
output = 'ERROR:INVALID_INP'
self.transport.write('LICKTHECOINS:{}\n'.format(output).encode('utf-8'))
self.transport.write('LICKTHECOIN:{}\n'.format(output).encode('utf-8'))
class Factory(protocol.Factory):
def buildProtocol(self, addr):