mirror of
https://github.com/ankitects/anki.git
synced 2025-09-23 16:26:40 -04:00
use sha1 everywhere; the speed differences are negligible
This commit is contained in:
parent
eca6ef204f
commit
4b710b5a87
2 changed files with 3 additions and 6 deletions
|
@ -4,7 +4,7 @@
|
|||
|
||||
import re, os, random, time, types, math, htmlentitydefs, subprocess, \
|
||||
tempfile, shutil
|
||||
from hashlib import md5, sha1
|
||||
from hashlib import sha1
|
||||
from anki.lang import _, ngettext
|
||||
import locale, sys
|
||||
|
||||
|
@ -198,9 +198,6 @@ def splitFields(string):
|
|||
##############################################################################
|
||||
|
||||
def checksum(data):
|
||||
return md5(data).hexdigest()
|
||||
|
||||
def sha1sum(data):
|
||||
return sha1(data).hexdigest()
|
||||
|
||||
def fieldChecksum(data):
|
||||
|
|
|
@ -89,7 +89,7 @@ def test_fieldChecksum():
|
|||
f['Front'] = u"new"; f['Back'] = u"new2"
|
||||
deck.addFact(f)
|
||||
assert deck.db.scalar(
|
||||
"select csum from fsums") == int("22af645d", 16)
|
||||
"select csum from fsums") == int("c2a6b03f", 16)
|
||||
# empty field should have no checksum
|
||||
f['Front'] = u""
|
||||
f.flush()
|
||||
|
@ -99,7 +99,7 @@ def test_fieldChecksum():
|
|||
f['Front'] = u"newx"
|
||||
f.flush()
|
||||
assert deck.db.scalar(
|
||||
"select csum from fsums") == int("4b0e5a4c", 16)
|
||||
"select csum from fsums") == int("302811ae", 16)
|
||||
# turning off unique and modifying the fact should delete the sum
|
||||
m = f.model()
|
||||
m['flds'][0]['uniq'] = False
|
||||
|
|
Loading…
Reference in a new issue