how are variable key sizes produced?

I am current learning the internal working of several Symmetric key Cryptographic algorithms, and came across DES and AES.

DES takes in input a 64 bit key and AES-128 takes in input a 128 bit key

My question is, since the user provides these algorithms inputs of variable size (or bits), then how is it able to upscale/downscale it to lower bits in order to feed it to the algorithm. Does it uses KDF (key Derivation function)? If yes, then is the KDF capable of decreasing the size of bits too?

By decreasing I mean, If the User Inputs a key = APPLE PIES, and gives it as an input to DES. Then how is DES able to convert this (80 bit) key into a 64 bit one?

Does it use KDF (key Derivation function)? If yes, then is the KDF capable of decreasing the size of bits too?

...how is DES able to convert this (80 bit) key into a 64 bit one?

AES and DES do not perform this task. The specification states that AES uses two sequence of 128 bits as input.

"key" means "cryptographically strong bits".

Something like APPLE PIES is a password rather than a key.

how is it able to upscale/downscale it to lower bits in order to feed it to the algorithm. Does it uses KDF (key Derivation function)? If yes, then is the KDF capable of decreasing the size of bits too?

The key derivation process may involve multiple invocations and iterations to generate output larger then the output size of the hash function, and the application may truncate keys down to the correct size when necessary.

How to derive a key from a password

• So is it possible to create a variable sized key from a password, i.e. a key from a password could be produced via a hashing algorithm. A hashing algorithm has a definite length output, but as mentioned DES and AES used two different sized keys (64 bits and 128 bits). Then how is different sized keys derived out from arbitrary length password. Let's say i want to use the same passphrase for both AES and DES, then how does different sized key's calculated out of the same password? – Vasu Deo.S Jun 17 at 18:23
• A hashing algorithm has a definite length output. But a hash function is not a key derivation function. A hash function is used in the key derivation process, but it is only a part of the procedure. The key derivation process may involve multiple invocations and iterations to generate output larger then the output size of the hash function, and the application may truncate keys down to the correct size when necessary. – Ella Rose Jun 17 at 18:34