纯猝使用VBScript来实现加密

2016-01-29 18:27 29 1 收藏

纯猝使用VBScript来实现加密,纯猝使用VBScript来实现加密

【 tulaoshi.com - ASP 】

  <%
'### To encrypt/decrypt include this code in your page
'### strMyEncryptedString = EncryptString(strString)
'### strMyDecryptedString = DeCryptString(strMyEncryptedString)
'### You are free to use this code as long as credits remain in place
'### also if you improve this code let me know.

Private Function EncryptString(strString)
'####################################################################
'### Crypt Function (C) 2001 by Slavic Kozyuk grindkore@yahoo.com ###
'### Arguments: strString <--- String you wish to encrypt         ###
'### Output: Encrypted HEX string                                 ###
'####################################################################

Dim CharHexSet, intStringLen, strTemp, strRAW, i, intKey, intOffSet
Randomize Timer

intKey = Round((RND * 1000000) + 1000000)   '##### Key Bitsize
intOffSet = Round((RND * 1000000) + 1000000)   '##### KeyOffSet Bitsize

If IsNull(strString) = False Then
strRAW = strString
intStringLen = Len(strRAW)

For i = 0 to intStringLen - 1
strTemp = Left(strRAW, 1)
strRAW = Right(strRAW, Len(strRAW) - 1)
CharHexSet = CharHexSet & Hex(Asc(strTemp) * intKey)
& Hex(intKey)
Next

EncryptString = CharHexSet & "|" & Hex(intOffSet + intKey) & "|" & Hex(intOffSet)
Else
EncryptString = ""
End If
End Function




Private Function DeCryptString(strCryptString)
'####################################################################
'### Crypt Function (C) 2001 by Slavic Kozyuk grindkore@yahoo.com ###
'### Arguments: Encrypted HEX stringt       ###
'### Output: Decrypted ASCII string                               ###
'####################################################################
'### Note this function uses HexConv() and get_hxno() functions   ###
'### so make sure they are not removed
  ###
'####################################################################

Dim strRAW, arHexCharSet, i, intKey, intOffSet, strRawKey, strHexCrypData


strRawKey = Right(strCryptString, Len(strCryptString) - InStr(strCryptString, "|"))
intOffSet = Right(strRawKey, Len(strRawKey) - InStr(strRawKey,"|"))
intKey = HexConv(Left(strRawKey, InStr(strRawKey, "|") - 1)) - HexConv(intOffSet)
strHexCrypData = Left(strCryptString, Len(strCryptString) - (Len(strRawKey) + 1))


arHexCharSet = Split(strHexCrypData, Hex(intKey))

For i=0 to UBound(arHexCharSet)
strRAW = strRAW & Chr(HexConv(arHexCharSet(i))/intKey)
Next

DeCryptString = strRAW
End Function



Private Function HexConv(hexVar)
Dim hxx, hxx_var, multiply
IF hexVar < "" THEN
hexVar = UCASE(hexVar)
hexVar = StrReverse(hexVar)
DIM hx()
REDIM hx(LEN(hexVar))
hxx = 0
hxx_var = 0
FOR hxx = 1 TO LEN(hexVar)
IF multiply = "" THEN multiply = 1
hx(hxx) = mid(hexVar,hxx,1)
hxx_var = (get_hxno(hx(hxx)) * multiply) + hxx_var
multiply = (multiply * 16)
NEXT
hexVa

来源:https://www.tulaoshi.com/n/20160129/1505897.html

延伸阅读
标签: Web开发
!DOCTYPE a href="/keys/html/index.html" target="_blank"html/a PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd" html xmlns="http://www.w3.org/1999/xhtml" xml:lang="zh" lang="zh" head profile="http://www.w3.org/2000/08/w3c-synd/#" meta http-equiv="content-language" content="z...
用DELPHI实现文件加密压缩 作者: e梦缘 (wnhoo) Mail:wnhoo@163.com 风花雪月 e梦情缘 点击下载此详细说明文件 概述: 在这篇文件中,讲述对单个文件的数据加密、数据压缩、自解压的实现。同样,也可以实现对多个文件或文件夹的压缩,只要稍加修改便可实现。 关键...
利用异或的性质来对文件进行加密: 代码如下: c=a^b c^b=a #include "stdio.h" #include "stdlib.h" void main(int argc,char *argv[]) {  FILE *fp1,*fp2;  char c,ch;  long j;  if(3!=argc)  {   printf("Command error/n");   exit(1);  }  if((fp1=fopen(argv[1],"rb"))==NULL) &nb...
标签: 电脑入门
A、加密文件: 1、在您想要加密的文件上单击鼠标右键,您可以一次选择多个文件; 2、在出现的功能表中选择QKEY加密; 3、在的对话框中输入新账号和密码,确定; 4、不论被加密文件格式如何,加密后文件显示为锁的符号,后缀名变成.QKY B、解密文件: 1、在想解密的文件上单击右键; 2、在出现的功能表中选择QKEY解密; 3、输入账号与密码。 ...
标签: Web开发
文字加密解密 文字加密解密:将你的文字拷贝入下面的输入框,即可完成文字的加密解密 文字加密解密 将你的文字拷贝入下面的输入框,即可完成文字的加密解密 原字符串: 加密结果: 密文字符: 加密码是以41个不同的字母组成的字符串,不同加密码,加密解密结果不同,加密结果以加...

经验教程

962

收藏

65
微博分享 QQ分享 QQ空间 手机页面 收藏网站 回到头部