The Secure Hash Algorithm (SHA) was developed by NIST and NSA to generate a 160-bit message digest from inputs of less than 264 bits. SHA-1 works by padding the input message, appending the length, dividing into 512-bit blocks, initializing chain variables, and processing each block through 80 iterations involving logical, shift, and addition operations to update the variables. Each iteration uses a constant and the previous output to calculate the next output in order to make it difficult to determine the input from the digest or find colliding messages. Later versions such as SHA-256 increased security by lengthening the digest and number of steps.