コード例 #1
0
ファイル: hashl.py プロジェクト: lifegpc/csweb
def md5(s, encoding='utf8') -> str:
    if isinstance(s, str):
        b = s.encode(encoding)
    elif isinstance(s, bytes):
        b = s
    else:
        b = str(s).encode(encoding)
    h = __md5()
    h.update(b)
    return h.hexdigest()
コード例 #2
0
def __md5digest(filename):
	"""
	For internal use only.
	"""
	m = __md5()
	f = open(filename)
	while True:
		d = f.read(4096)
		if not d:
			break
		m.update(d)
	return m.hexdigest()
コード例 #3
0
ファイル: saomd5.py プロジェクト: schetudiante/4chan-Scraper
def hashHex(filepath,blocksize=65536): #65536
    """Return the MD5 hash of the file at $filepath as a string"""
    with open(filepath,'rb') as file:
        hasher = __md5()
        while len(buffer := file.read(blocksize)) > 0:
            hasher.update(buffer)
コード例 #4
0
ファイル: auth.py プロジェクト: doom118/altaire
# $Id: auth.py,v 1.41 2008/09/13 21:45:21 normanr Exp $

"""
Provides library with all Non-SASL and SASL authentication mechanisms.
Can be used both for client and transport authentication.
"""

from protocol import *
from client import PlugIn
from random import random as _random
from hashlib import md5 as __md5
from re import findall as re_findall
from base64 import encodestring, decodestring
import dispatcher

HH = lambda some: __md5(some).hexdigest()
H = lambda some: __md5(some).digest()
C = lambda some: ':'.join(some)

class NonSASL(PlugIn):
	""" Implements old Non-SASL (JEP-0078) authentication used in jabberd1.4 and transport authentication."""
	def __init__(self,user,password,resource):
		""" Caches username, password and resource for auth. """
		PlugIn.__init__(self)
		self.DBG_LINE='gen_auth'
		self.user=user
		self.password=password
		self.resource=resource

	def plugin(self,owner):
		""" Determine the best auth method (digest/0k/plain) and use it for auth.
コード例 #5
0
ファイル: auth.py プロジェクト: HighwayStar/vk4xmpp
def H(some):
    return __md5(some).digest()
コード例 #6
0
ファイル: auth.py プロジェクト: HighwayStar/vk4xmpp
def HH(some):
    return __md5(some).hexdigest()
コード例 #7
0
ファイル: auth.py プロジェクト: HighwayStar/vk4xmpp
def H(some):
	return __md5(some).digest()
コード例 #8
0
ファイル: auth.py プロジェクト: HighwayStar/vk4xmpp
def HH(some):
	return __md5(some).hexdigest()