mirror of
				https://github.com/ethereum/solidity
				synced 2023-10-03 13:03:40 +00:00 
			
		
		
		
	
		
			
				
	
	
		
			14 lines
		
	
	
		
			479 B
		
	
	
	
		
			Solidity
		
	
	
	
	
	
			
		
		
	
	
			14 lines
		
	
	
		
			479 B
		
	
	
	
		
			Solidity
		
	
	
	
	
	
contract C {
 | 
						|
    function f(string memory s) public returns (bool ret) {
 | 
						|
        assembly {
 | 
						|
            let a := keccak256(s, 32)
 | 
						|
            let b := keccak256(s, 8)
 | 
						|
            ret := eq(a, b)
 | 
						|
        }
 | 
						|
    }
 | 
						|
}
 | 
						|
// ----
 | 
						|
// f(string): "" -> false
 | 
						|
// f(string): 0x20, 5, "hello" -> false
 | 
						|
// f(string): 0x20, 0x2e, 29457663690442756349866640336617293820574110049925353194191585327958485180523, 45859201465615193776739262511799714667061496775486067316261261194408342061056 -> false
 |