Why did the NSA create SHA? new to cryptography, i'm trying to learn the program veracrypt, and i'm now trying to understand the history of hash functions and how it applies to veracrypt. 

so this is what i understand so far, the NSA made SHA2, which is one of the hash functions that veracrypt can use for it's "key derivation function" and the NSA made SHA2 because they wanted an improvement on SHA1, and they made SHA1 because they wanted an improvement on SHA0.

what i don't understand is, why did NSA make SHA0 in the first place? and when did hash functions start being used for password storing and "key derivation functions"? 

did hash functions start with the need for network security for verifying package? or did they start with the need of hashing passwords or both or what was the deal? 

thanks!
The NSA created SHA (quickly replaced by SHA-1 to fix a security issue that remained unpublished for years) because they/the US government needed a 160-bit hash function, so that it has 80-bit security against collision-resistance, in particular towards use in the DSA signature system of FIPS&nbsp;140.

In this usage, a hash functions condenses a possibly large piece of information $m$ (e.g. a 10MB file) into a smaller, easier to manipulate piece of information $h=H(m)$ (20 bytes for SHA-1), wich is what really gets signed. The hash must be collision-resistant, so that an adversary can't come with two distinct messages $m$ and $m'$ with $H(m)=H(m')$, which would allow the adversary to obtain a signature for $m$ from a legitimate signer, and pass it as the signature for $m'$.

SHA-1 uses principles similar to the earlier 128-bit MD5, but with a more regular design. Also it is big-endian, likely because that's customary (to the point of being unstated) in NIST crypto standards including DES/FIPS&nbsp;43.