mirror of
				https://github.com/python/cpython.git
				synced 2025-11-04 07:31:38 +00:00 
			
		
		
		
	
		
			
	
	
		
			12 lines
		
	
	
	
		
			240 B
		
	
	
	
		
			Python
		
	
	
	
	
	
		
		
			
		
	
	
			12 lines
		
	
	
	
		
			240 B
		
	
	
	
		
			Python
		
	
	
	
	
	
| 
								 | 
							
								import sqlite3
							 | 
						||
| 
								 | 
							
								import hashlib
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								def md5sum(t):
							 | 
						||
| 
								 | 
							
								    return hashlib.md5(t).hexdigest()
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								con = sqlite3.connect(":memory:")
							 | 
						||
| 
								 | 
							
								con.create_function("md5", 1, md5sum)
							 | 
						||
| 
								 | 
							
								cur = con.cursor()
							 | 
						||
| 
								 | 
							
								cur.execute("select md5(?)", ("foo",))
							 | 
						||
| 
								 | 
							
								print(cur.fetchone()[0])
							 |