return false by default
This commit is contained in:
		
							parent
							
								
									bf5d18e73a
								
							
						
					
					
						commit
						1369d91375
					
				
							
								
								
									
										13
									
								
								hashcash.go
									
									
									
									
									
								
							
							
						
						
									
										13
									
								
								hashcash.go
									
									
									
									
									
								
							| @ -216,6 +216,10 @@ func (h *Hashcash) Verify(subject string) error { | ||||
| } | ||||
| 
 | ||||
| func verifyBits(hash []byte, bits, n int) bool { | ||||
| 	if 0 == bits { | ||||
| 		return true | ||||
| 	} | ||||
| 
 | ||||
| 	for i := 0; i < n; i++ { | ||||
| 		if bits > 8 { | ||||
| 			bits -= 8 | ||||
| @ -227,15 +231,12 @@ func verifyBits(hash []byte, bits, n int) bool { | ||||
| 
 | ||||
| 		// (bits % 8) == bits | ||||
| 		pad := 8 - bits | ||||
| 		if 0 != hash[i]>>pad { | ||||
| 			return false | ||||
| 		if 0 == hash[i]>>pad { | ||||
| 			return true | ||||
| 		} | ||||
| 
 | ||||
| 		return true | ||||
| 	} | ||||
| 
 | ||||
| 	// 0 == bits | ||||
| 	return true | ||||
| 	return false | ||||
| } | ||||
| 
 | ||||
| // Solve will search for a solution, returning an error if the difficulty is | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user