# RoseCliff Algorithm: Making Passwords Dynamic
## 4 Implementation
### Authentication Process  
The authentication process in RoseCliff comprises two essential steps due to the introduction of dynamism in passwords before encryption. Initially, the received password over the network is decrypted using the same techniques employed just before its transmission. Subsequently, the randomized password segment is distinguished from the nonrandomized segment. The randomized portion is utilized to compare values, which are also generated on the server side. In parallel, the nonrandomized segment undergoes decryption of the previously stored password for comparison. Authentication is granted only when both comparisons are valid as seen in Algorithm 3.  
```
Server and Client \(Pr\leftarrow\) server generates a Prime number and shares with client \(PP\leftarrow\) server generates a Primitive-Prime number and shares with client Server Side \(OTN\leftarrow\) server generates a one time number \(SV\leftarrow(PP^{OTN})\mod Pr\) \(RandomValue\leftarrow(SV^{OTN})\mod Pr\) Client Side \(Ps\leftarrow\) Password segment \(CV\leftarrow(PP^{Ps})\mod Pr\) \(P\) \(RandomValue\leftarrow(CV^{Ps})\mod Pr\) \(RandomHex\leftarrow\) convertToBase16\((RandomValue)\) \(RandomPass\leftarrow RandomHex([a,b,c,d,e,f]\leftarrow[e,t,a,i,o,n,s,h,r])\) \(DynamicPassword\leftarrow\) Map\((Password,RandomPass,NumIndex)\) procedureEncryptPassword(DynamicPassword) \(key\leftarrow\) GenerateAESKey() \(v\leftarrow\) GenerateInitializationVector() \(\triangleright\) Generate an initialization vector \(encryptedPassword\leftarrow\) AES-256-Encrypt(password, key, iv) return\(encryptedPassword\) endprocedure
```  
**Algorithm 2** Dynamic Password/Ciphertext Password Generation  
```
\(EncP\leftarrow\) Encrypted Password \(\triangleright\) Recently sent over network \(OEncP\leftarrow\) Old Encrypted Password \(\triangleright\) Previously store by Authentication system \(NumIndex\leftarrow\) Indexing locations of the numbers from the original password \(RandomValue\leftarrow\) Previously calculated during Dynamic Password generation \(RandomHex\leftarrow\) convertToBase16\((RandomValue)\) \(RandomPass\leftarrow RandomHex([a,b,c,d,e,f]\leftarrow[e,t,a,i,o,n,s,h,r])\) procedureDecryptPassword(EncP) \(decryptedPassword\leftarrow\) AES-256-Encrypt(EncP, key, iv) return\(decryptedPassword\) endprocedure PasswordNew, RandomPassNew\(\leftarrow\) Map\((decryptedPassword,NumIndex)\) if\(RandomPass=RandomPassNew\)then Verification1\(\leftarrow\) true else Verification1\(\leftarrow\) false endif procedureDecryptPassword(OEncP) \(decryptedPassword2\leftarrow\) AES-256-Encrypt(OEncP, key, iv) return\(decryptedPassword2\) endprocedure Password20 Id, RandomPassOld\(\leftarrow\) Map\((decryptedPassword,NumIndex)\) if\(PasswordNew=Password20 Id\)then Verification2\(\leftarrow\) true else Verification2\(\leftarrow\) false endif if\(RandomPassNew=RandomPassOld\)then Verification2\(\leftarrow\) true else Verification2\(\leftarrow\) false endif Verification2\(\leftarrow\) false endif Verification1\(\leftarrow\) true and Verification2 is true then Authenticated endif
```  
**Algorithm 3** Authentication Process  
In this particular implementation, the verification process initiates with the decryption of the password received over the network. By utilizing index locations, the nonrandomized password segment is then separated from its randomized counterpart. Subsequently, employing the NumIndex, the value obtained from the Diffie-Hellman Algorithm undergoes hashing and mapping. This result is matched against the randomized password segment to ascertain its validity. Concurrently, the previously stored password is decrypted, the NumIndex is applied to isolate the nonrandomized password segment, and a comparison is conducted. The user is authenticated only when both comparisons yield successful outcomes.