code: func removePadding(payload []byte) ([]byte, byte) {
  	if len(payload) < 1 {
  		return payload, 0
  	}
  
  	paddingLen := payload[len(payload)-1]
  	t := uint(len(payload)-1) - uint(paddingLen)
  	// if len(payload) >= (paddingLen - 1) then the MSB of t is zero
  	good := byte(int32(^t) >> 31)
  
  	toCheck := 255 // the maximum possible padding length
  	// The length of the padded data is public, so we can use an if here
  	if toCheck+1 > len(payload) {
  		toCheck = len(payload) - 1
  	}
  
  	for i := 0; i < toCheck; i++ {
  		t := uint(paddingLen) - uint(i)
  		// if i <= paddingLen then the MSB of t is zero
  		mask := byte(int32(^t) >> 31)
  		b := payload[len(payload)-1-i]
  		good &^= mask&paddingLen ^ mask&b
  	}
  
  	// We AND together the bits of good and replicate the result across
  	// all the bits.
  	good &= good << 4
  	good &= good << 2
  	good &= good << 1
  	good = uint8(int8(good) >> 7)
  
  	toRemove := good&paddingLen + 1
  	return payload[:len(payload)-int(toRemove)], good
  }
docs: // removePadding returns an unpadded slice, in constant time, which is a prefix
  // of the input. It also returns a byte which is equal to 255 if the padding
  // was valid and 0 otherwise. See RFC 2246, section 6.2.3.2