| 116 | |
| 117 | // Define a singleton class for SHA512 Hashing |
| 118 | class SHA512Hashing implements Hashing { |
| 119 | private static instance: SHA512Hashing; |
| 120 | |
| 121 | private constructor() {} |
| 122 | |
| 123 | // Get the singleton instance |
| 124 | // 获取单例实例 |
| 125 | public static getInstance(): SHA256Hashing { |
| 126 | if (!SHA512Hashing.instance) { |
| 127 | SHA512Hashing.instance = new SHA512Hashing(); |
| 128 | } |
| 129 | return SHA512Hashing.instance; |
| 130 | } |
| 131 | |
| 132 | hash(plainText: string) { |
| 133 | return SHA512(plainText).toString(); |
| 134 | } |
| 135 | } |
| 136 | |
| 137 | export class EncryptionFactory { |
| 138 | public static createAesEncryption(params: EncryptionParams): Encryption { |
nothing calls this directly
no outgoing calls
no test coverage detected