Skip to content
This repository has been archived by the owner on Oct 17, 2021. It is now read-only.

Do not depend on deprecated md5 #32

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 5 additions & 6 deletions filters/latex/latex2img.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,10 @@
granted under the terms of the MIT License.
'''

# Suppress warning: "the md5 module is deprecated; use hashlib instead"
import warnings
warnings.simplefilter('ignore',DeprecationWarning)

import os, sys, tempfile, md5
import hashlib
import os
import sys
import tempfile

VERSION = '0.2.0'

Expand Down Expand Up @@ -132,7 +131,7 @@ def latex2img(infile, outfile, imgfmt, dpi, modified):
if infile == '-':
tex = sys.stdin.read()
if modified:
checksum = md5.new(tex + imgfmt + str(dpi)).digest()
checksum = hashlib.md5(tex + imgfmt + str(dpi)).digest()
md5_file = os.path.splitext(outfile)[0] + '.md5'
if os.path.isfile(md5_file) and os.path.isfile(outfile) and \
checksum == read_file(md5_file,'rb'):
Expand Down
11 changes: 5 additions & 6 deletions filters/music/music2png.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,10 @@
granted under the terms of the GNU General Public License (GPL).
'''

# Suppress warning: "the md5 module is deprecated; use hashlib instead"
import warnings
warnings.simplefilter('ignore',DeprecationWarning)

import os, sys, tempfile, md5
import hashlib
import os
import sys
import tempfile

VERSION = '0.1.2'

Expand Down Expand Up @@ -103,7 +102,7 @@ def music2png(format, infile, outfile, modified):
skip = False
if infile == '-':
source = sys.stdin.read()
checksum = md5.new(source).digest()
checksum = hashlib.md5(source).digest()
filename = os.path.splitext(outfile)[0] + '.md5'
if modified:
if os.path.isfile(filename) and os.path.isfile(outfile) and \
Expand Down