SONAR-10407 Ensure that the kee length is not greater than 40
In this case, we must update the kee to a UUID
178129
private String updateKeeIfRequired(Context context, @Nullable String kee) throws SQLException {
    if (kee == null || kee.length() <= VarcharColumnDef.UUID_SIZE) {
      return kee;
    }

    String newKee = uuidFactory.create();
    context.prepareUpsert("update permission_templates set kee=? where kee=?")
      .setString(1, newKee)
      .setString(2, kee)
      .execute();
    return newKee;
  }
1028794
def change_length(self, parameter, value):
        
        """

        self.preamble.append(UnsafeCommand('setlength',
                                           arguments=[parameter, value]))
663735
function checkLengths(k, n) {
  if (k.length !== crypto_secretbox_KEYBYTES) throw new Error('bad key size');
  if (n.length !== crypto_secretbox_NONCEBYTES) throw new Error('bad nonce size');
}
1061789
def encode(self, uuid, pad_length=None):
        
        if pad_length is None:
            pad_length = self._length
        return int_to_string(uuid.int, self._alphabet, padding=pad_length)
841106
public IssueDto setProjectUuid(String s) {
    checkArgument(s.length() <= 50, "Value is too long for column ISSUES.PROJECT_UUID: %s", s);
    this.projectUuid = s;
    return this;
  }
517250
def set_length_and_maybe_checksums(self, record, payload_offset=None):
        ''''''
        if self._params.digests:
            record.compute_checksum(payload_offset)
        else:
            record.set_content_length()
175354
void updateBytesSent(long bytes) {
        if(Connectors.isEntityBodyAllowed(this) && !getRequestMethod().equals(Methods.HEAD)) {
            responseBytesSent += bytes;
        }
    }
1281273
public void setUUID(SIBUuid12 value) {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
            SibTr.entry(tc, "setUUID", value);
        }
        _uuid = value;
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.exit(tc, "setUUID");
    }
1217153
private static void updateLengthAndBytes(MessageDigest digest, ByteBuffer binaryValue) {
        ByteBuffer readOnlyBuffer = binaryValue.asReadOnlyBuffer();
        int size = readOnlyBuffer.remaining();
        ByteBuffer lengthBytes = ByteBuffer.allocate(INTEGER_SIZE_IN_BYTES).putInt(size);
        digest.update(lengthBytes.array());
        digest.update(readOnlyBuffer);
    }
805583
def update(self, buffer, length):
        
        return lib.zdigest_update(self._as_parameter_, buffer, length)
36434
function setUuid(node, uuid) {
    var uuidBytes = uuid instanceof KdbxUuid ? uuid.toBytes() : uuid;
    setBytes(node, uuidBytes);
}
1117721
public void setMinTokenLength(int minTokenLength)
    {
        if(minTokenLength < 0)
            throw new IllegalArgumentException("Minimum token length must be non negative, not " + minTokenLength);
        if(minTokenLength > maxTokenLength)
            throw new IllegalArgumentException("Minimum token length can not exced the maximum token length");
        this.minTokenLength = minTokenLength;
    }
1139173
def hkdf_expand(pseudo_random_key, info=b"", length=32, hash=hashlib.sha512):
	'''
	
	'''
	hash_len = hash().digest_size
	length = int(length)
	if length > 255 * hash_len:
		raise Exception("Cannot expand to more than 255 * %d = %d bytes using the specified hash function" %\
			(hash_len, 255 * hash_len))
	blocks_needed = length // hash_len + (0 if length % hash_len == 0 else 1) # ceil
	okm = b""
	output_block = b""
	for counter in range(blocks_needed):
		output_block = hmac.new(pseudo_random_key, buffer(output_block + info + bytearray((counter + 1,))),\
			hash).digest()
		okm += output_block
	return okm[:length]
360840
public int updateExpirationTime(Object id, long oldExpirationTime, int size, long newExpirationTime, long newValidatorExpirationTime) {
        int returnCode = this.htod.updateExpirationTime(id, oldExpirationTime, size, newExpirationTime, newValidatorExpirationTime);
        if (returnCode == HTODDynacache.DISK_EXCEPTION) {
            stopOnError(this.htod.diskCacheException);
        }
        return returnCode;
    }
948776
def hotp_truncate(hmac_result, length=6):
    
    if len(hmac_result) != 20:
        raise yubico_exception.YubicoError("HMAC-SHA-1 not 20 bytes long")
    offset   =  ord_byte(hmac_result[19]) & 0xf
    bin_code = (ord_byte(hmac_result[offset]) & 0x7f) << 24 \
        | (ord_byte(hmac_result[offset+1]) & 0xff) << 16 \
        | (ord_byte(hmac_result[offset+2]) & 0xff) <<  8 \
        | (ord_byte(hmac_result[offset+3]) & 0xff)
    return bin_code % (10 ** length)
950304
def truncate(hmac_result, length=6):
    
    assert(len(hmac_result) == 20)
    offset   =  ord(hmac_result[19]) & 0xf
    bin_code = (ord(hmac_result[offset]) & 0x7f) << 24 \
        | (ord(hmac_result[offset+1]) & 0xff) << 16 \
        | (ord(hmac_result[offset+2]) & 0xff) <<  8 \
        | (ord(hmac_result[offset+3]) & 0xff)
    return bin_code % (10 ** length)
978283
def _update_length(self):
        
        if (self.audio_sample_rate is not None) and (self.__samples is not None):
            # NOTE computing TimeValue (... / ...) yields wrong results,
            #      see issue #168
            #      self.audio_length = TimeValue(self.__samples_length / self.audio_sample_rate)
            self.audio_length = TimeValue(self.__samples_length) / TimeValue(self.audio_sample_rate)