hashy hash
This commit is contained in:
parent
7514694ba7
commit
6276dfea72
13
server.py
13
server.py
|
@ -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):
|
||||
|
|
Loading…
Reference in New Issue