mirror of
				https://github.com/python-pillow/Pillow.git
				synced 2025-11-04 01:47:47 +03:00 
			
		
		
		
	flake8 Tests/make_hash.py
This commit is contained in:
		
							parent
							
								
									1bbe850f5b
								
							
						
					
					
						commit
						3b3fc441b1
					
				| 
						 | 
					@ -1,7 +1,5 @@
 | 
				
			||||||
# brute-force search for access descriptor hash table
 | 
					# brute-force search for access descriptor hash table
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import random
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
modes = [
 | 
					modes = [
 | 
				
			||||||
    "1",
 | 
					    "1",
 | 
				
			||||||
    "L", "LA",
 | 
					    "L", "LA",
 | 
				
			||||||
| 
						 | 
					@ -13,12 +11,14 @@ modes = [
 | 
				
			||||||
    "YCbCr",
 | 
					    "YCbCr",
 | 
				
			||||||
    ]
 | 
					    ]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
def hash(s, i):
 | 
					def hash(s, i):
 | 
				
			||||||
    # djb2 hash: multiply by 33 and xor character
 | 
					    # djb2 hash: multiply by 33 and xor character
 | 
				
			||||||
    for c in s:
 | 
					    for c in s:
 | 
				
			||||||
        i = (((i << 5) + i) ^ ord(c)) & 0xffffffff
 | 
					        i = (((i << 5) + i) ^ ord(c)) & 0xffffffff
 | 
				
			||||||
    return i
 | 
					    return i
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
def check(size, i0):
 | 
					def check(size, i0):
 | 
				
			||||||
    h = [None] * size
 | 
					    h = [None] * size
 | 
				
			||||||
    for m in modes:
 | 
					    for m in modes:
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue
	
	Block a user