Encrypt your data using the ASP encryption algorithm (1)

zhaozj2021-02-16  66

Introduction

First briefly introduce the background of the encrypted background. Due to the US prohibiting several cryptographic algorithms (eg, 40-bit encryption restrictions on SSL), this article will introduce an ASP that can be used in the simple character encryption algorithm, not those limited. In fact, the encryption algorithm introduced here is enough to decrypt people for a while for the general purpose. Its encryption basis is the simplest Vernum password method, I will introduce this password in the next article.

Its basic principle is that there is a need for a need to encrypt.

Ming Text and a randomly generated decryption key file. Then use these two files to generate ciphertext.

(Plain text) combination (key) = encrypted ciphertext

So this article describes the code that generates a key. We assume that we have a key to 512-bit keys, which is enough to encrypt a text character. code show as below:

Keygen.asp file

<%

'*****************************

'KEYGEN.ASP

'*****************************

Const g_keylocation = "c: /key.txt"

Const g_keylen = 512

ON Error ResMe next

Call writekeyTofile (Keygen (g_keylen), g_keylocation

IF Err <> 0 Then Response.Write "Error Generating Key." & "

" response.write err.number & "
" response.write err.description & "
" else response.write " Key successfully generated. "END IF

Sub WriteKeyToFile (MyKeyString, strFileName) Dim keyFile, fso set fso = Server.CreateObject ( "scripting.FileSystemObject") set keyFile = fso.CreateTextFile (strFileName, true) keyFile.WriteLine (MyKeyString) keyFile.Close End Sub

Function KeyGeN (iKeyLength) Dim k, iCount, strMyKey lowerbound = 35 upperbound = 96 Randomize 'Initialize random-number generator For I = 1 to iKeyLength s = 255 k = Int (((upperbound -. Lowerbound) 1) * Rnd LowerBound) strmykey = strmykey & chr (k) & "Next keygen = strmyKey End Function

%> Run the top of the key .asp page in IIS. You only need this to do this, he will write the key in the file C: /key.txt (if you like, you can also put this file in another more secure place). Then you can open this key .txt file, it will contain 512 ASCII code characters between 35 to 96. And because it is randomly generated, the private key files of each person will be different, the following is an example key file:

Iy /; $> = 3) ^ - 7M32 # q] Voii.q = OFMC`: p7_b; #, . AW _ / '] DIB; 2DTIA57TT & -) O '/ * F'M> H.XH5W ^ 0y * = 71 5 * ^ `^ PKJ (= E / X # 7A:?, S> R & T; B # <: - * / @) X9f`_`% qa3z95.? _ T # 1, $ 2 # fww5pbh ^ * <] ) A (S0 @ AVD8C ^ Q0R ^ T1D? (1 , ye71x . * U $: 3xo ^ q] .kg & 0N0]; [LJ

转载请注明原文地址:https://www.9cbs.com/read-13007.html

New Post(0)