import { SHA1, SHA384, SHA3 } from 'crypto-js'

type versions = 'v1' | 'v2'

export default async (password: string, version: versions) => {
  const firstHashing = SHA1(password)
  const secondHashing = version === 'v1' ? SHA3(firstHashing.toString()) : SHA384(firstHashing.toString())
  const thirdHashing = SHA1(secondHashing.toString())

  return thirdHashing.toString()
}