mirror of
				https://github.com/crypto-pro-web/crypto-pro-js.git
				synced 2025-10-31 06:13:22 +03:00 
			
		
		
		
	Оставил генерацию хэша только для алгоритма ГОСТ Р 34.11-2012 256 бит
This commit is contained in:
		
							parent
							
								
									019e825895
								
							
						
					
					
						commit
						b400e8c670
					
				| @ -2,31 +2,16 @@ import { _afterPluginsLoaded } from '../helpers/_afterPluginsLoaded'; | ||||
| import { _extractMeaningfulErrorMessage } from '../helpers/_extractMeaningfulErrorMessage'; | ||||
| import { __cadesAsyncToken__, __createCadesPluginObject__, _generateCadesFn } from '../helpers/_generateCadesFn'; | ||||
| 
 | ||||
| type Algorithm = | ||||
|   | 'GOST_3411' | ||||
|   | 'GOST_3411_2012_256' | ||||
|   | 'GOST_3411_2012_512' | ||||
|   | 'GOST_3411_HMAC' | ||||
|   | 'GOST_3411_2012_256_HMAC' | ||||
|   | 'GOST_3411_2012_512_HMAC'; | ||||
| 
 | ||||
| /** | ||||
|  * Создает хэш сообщения по ГОСТ Р 34.11 | ||||
|  * Создает хэш сообщения по ГОСТ Р 34.11-2012 256 бит | ||||
|  * https://ru.wikipedia.org/wiki/%D0%A1%D1%82%D1%80%D0%B8%D0%B1%D0%BE%D0%B3_(%D1%85%D0%B5%D1%88-%D1%84%D1%83%D0%BD%D0%BA%D1%86%D0%B8%D1%8F)
 | ||||
|  * | ||||
|  * @param unencryptedMessage - сообщение для хеширования | ||||
|  * @param algorithm - один из алгоритмов хеширования: | ||||
|  * GOST_3411 | ||||
|  * GOST_3411_2012_256 | ||||
|  * GOST_3411_2012_512 - по умолчанию | ||||
|  * GOST_3411_HMAC | ||||
|  * GOST_3411_2012_256_HMAC | ||||
|  * GOST_3411_2012_512_HMAC | ||||
|  * | ||||
|  * @returns хэш | ||||
|  */ | ||||
| export const createHash = _afterPluginsLoaded( | ||||
|   async (unencryptedMessage: string | ArrayBuffer, algorithm: Algorithm = 'GOST_3411_2012_512'): Promise<string> => { | ||||
|   async (unencryptedMessage: string | ArrayBuffer): Promise<string> => { | ||||
|     const { cadesplugin } = window; | ||||
| 
 | ||||
|     return eval( | ||||
| @ -46,7 +31,7 @@ export const createHash = _afterPluginsLoaded( | ||||
|         try { | ||||
|           void ( | ||||
|             __cadesAsyncToken__ + | ||||
|             cadesHashedData.propset_Algorithm(cadesplugin['CADESCOM_HASH_ALGORITHM_CP_' + algorithm]) | ||||
|             cadesHashedData.propset_Algorithm(cadesplugin.CADESCOM_HASH_ALGORITHM_CP_GOST_3411_2012_256) | ||||
|           ); | ||||
|           void (__cadesAsyncToken__ + cadesHashedData.propset_DataEncoding(cadesplugin.CADESCOM_BASE64_TO_BINARY)); | ||||
|           void (__cadesAsyncToken__ + cadesHashedData.Hash(messageBase64)); | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user
	 vgoma
						vgoma