Commits

xabolxuux committed 3723f8d

switching to sha512 (from prev sha1)

Comments (0)

Files changed (2)

 while true
 do
   sleep 2
-  curl -s $SERVER > $FTEMP
+  curl -s $SERVER/$COUNT > $FTEMP
   if ! diff $FTEMP chat.log > /dev/null
   then
     # put here your favourite notif program call
 
   DATE=$(date "+%s")
   MSG="$USER: $LINE"
-  AUTH=$(echo -n "$DATE;$MSG" | openssl dgst -sha1 -hmac $PASSWD | cut -d' ' -f2)
+  AUTH=$(echo -n "$DATE;$MSG" | openssl dgst -sha512 -hmac $PASSWD | cut -d' ' -f2)
 
   curl --data-binary @<(echo -n $MSG) \
     -H "Date: $DATE" \
 from threading import Thread, Lock
 from SocketServer import ThreadingMixIn
 from BaseHTTPServer import HTTPServer, BaseHTTPRequestHandler
-from hashlib import sha1
+from hashlib import sha1, sha512
 from hmac import new as hmac
 import time
 import uuid
 
-messages = open("chatd.log", "rb").read().splitlines()
+messages = []
 
 lock = Lock()
 
         data = self.rfile.read(varLen)
         auth = self.headers['Authorization']
         date = self.headers['Date']
-        hash = hmac(key, date+";"+data, sha1).digest().encode('hex')
+        hash = hmac(key, date+";"+data, sha512).digest().encode('hex')
         if (auth == hash) and date.isdigit() and (int(date) > int(time.time()) - 5):
             log_write(data)
             self.send_response(200)
 def serve_on_port(port):
     server = ThreadingHTTPServer(("localhost",port), Handler)
     log_write("~startup~")
+    messages = open("chatd.log", "rb").read().splitlines()
     server.serve_forever()
 
 Thread(target=serve_on_port, args=[5002]).start()
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.