Skip to content
Permalink
Browse files

fixced "edit" function, it was broken on Python 3 because HMAC no lon…

…ger supplies a default
  • Loading branch information
fazalmajid committed Feb 16, 2020
1 parent 65692c3 commit f3c65596fed11a0546c1cdd3f657ac2407f696fb
Showing with 4 additions and 2 deletions.
  1. +4 −2 tembozapp/server.py
@@ -1,7 +1,8 @@
from __future__ import print_function, division
import sys, os, stat, logging, base64, time, imp, gzip, traceback, pprint, csv
import threading, io
import flask, sqlite3, string, requests, re, datetime, hmac, passlib.hash
import flask, sqlite3, string, requests, re, datetime, hmac, hashlib
import passlib.hash
import feedparser
import hashlib, socket, json, werkzeug, __main__
from . import param, update, filters, util, normalize, dbop, fts5
@@ -64,7 +65,8 @@ def __call__(self, environ, start_response):
# seed for CSRF protection nonces
nonce_seed = os.urandom(20)
def gen_nonce(msg):
return hmac.new(nonce_seed, msg).hexdigest()
return hmac.new(nonce_seed, msg.encode('utf-8'),
digestmod=hashlib.sha256).hexdigest()

def check_nonce(msg, nonce):
#return hmac.compare_digest(gen_nonce(msg), nonce.decode('hex'))

0 comments on commit f3c6559

Please sign in to comment.
You can’t perform that action at this time.