Exemplo n.º 1
0
def sub(data, good_md5):
    allchars = map(chr, range(256))
    for i, oldch in enumerate(data):
        for newch in allchars:
            data[i] = newch
            if _md5.new(data).hexdigest() == good_md5:
                return True
        data[i] = oldch
    return False
    def _generate_md5_file( self ):
        try:
            # create a new md5 hash
            m = _md5.new( open( self.addons_xml ).read() ).hexdigest()

            # save file
            self._save_file( m, self.addons_xml_md5 )

        except Exception as e:
            # oops
            print ("An error occurred creating addons.xml.md5 file!\n%s" % ( e, ))
Exemplo n.º 3
0
# Copyright 2016 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

import md5
import _md5

# md5 test
assert _md5.new("").hexdigest() == 'd41d8cd98f00b204e9800998ecf8427e'
assert _md5.new("hello").hexdigest() == '5d41402abc4b2a76b9719d911017c592'

assert md5.new("").hexdigest() == 'd41d8cd98f00b204e9800998ecf8427e'
assert md5.new("hello").hexdigest() == '5d41402abc4b2a76b9719d911017c592'
Exemplo n.º 4
0
try:
    import _md5 as md5
except ImportError:
    import md5

m = md5.new()
print m.hexdigest()
m.update("aoeu")
print m.hexdigest()
Exemplo n.º 5
0
from __future__ import absolute_import

import _hashlib

from ._util import PY2, PY33


if PY2:
    import _md5
    import _sha
    import _sha256
    import _sha512


    md5 = type(_md5.new())
    sha1 = type(_sha.new())
    sha224 = type(_sha256.sha224())
    sha256 = type(_sha256.sha256())
    sha384 = type(_sha512.sha384())
    sha512 = type(_sha512.sha512())
elif PY33:
    import _md5
    import _sha1
    import _sha256
    import _sha512


    md5 = type(_md5.md5())
    sha1 = type(_sha1.sha1())
    sha224 = type(_sha256.sha224())
    sha256 = type(_sha256.sha256())
Exemplo n.º 6
0
 def cript_md5(self, _md5):
     m = _md5.new()
     m.md5.new(self.mensagem).digest()