메뉴 건너뛰기

프로그램언어

조회 수 5724 추천 수 0 댓글 0
?

단축키

Prev이전 문서

Next다음 문서

크게 작게 위로 아래로 댓글로 가기 인쇄
?

단축키

Prev이전 문서

Next다음 문서

크게 작게 위로 아래로 댓글로 가기 인쇄
1000이란 숫자를 암호화 하면 MTAwMCAg 란 값을 얻는다.
MTAwMCAg를 받아 암호를 풀면 1000 이란 값을 얻는다.
암호화하기
------------------------------------------------------------------
<!-- #include virtual='/include/asp/amount.asp' -->
<%
amount = Base64encode(1000)
response.write amount
%>
암호화 풀기
-------------------------------------------------------------------
<!-- #include virtual='/include/asp/amount.asp' -->
<%
amount = Base64decode("MTAwMCAg")
response.write amount
%>
amount.asp
--------------------------------------------------------------
<%
Const sBASE_64_CHARACTERS = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"
Function Base64decode(ByVal asContents)
Dim lsResult
Dim lnPosition
Dim lsGroup64, lsGroupBinary
Dim Char1, Char2, Char3, Char4
Dim Byte1, Byte2, Byte3
If Len(asContents) Mod 4 > 0 Then asContents = asContents & String(4 - (Len(asContents) Mod 4), " ")
lsResult = ""
For lnPosition = 1 To Len(asContents) Step 4
lsGroupBinary = ""
lsGroup64 = Mid(asContents, lnPosition, 4)
Char1 = INSTR(sBASE_64_CHARACTERS, Mid(lsGroup64, 1, 1)) - 1
Char2 = INSTR(sBASE_64_CHARACTERS, Mid(lsGroup64, 2, 1)) - 1
Char3 = INSTR(sBASE_64_CHARACTERS, Mid(lsGroup64, 3, 1)) - 1
Char4 = INSTR(sBASE_64_CHARACTERS, Mid(lsGroup64, 4, 1)) - 1
Byte1 = Chr(((Char2 And 48) /16) Or (Char1 * 4) And &HFF)
Byte2 = lsGroupBinary & Chr(((Char3 And 60) /4) Or (Char2 * 16) And &HFF)
Byte3 = Chr((((Char3 And 3) * 64) And &HFF) Or (Char4 And 63))
lsGroupBinary = Byte1 & Byte2 & Byte3
lsResult = lsResult + lsGroupBinary
Next
Base64decode = lsResult
End Function
Function Base64encode(ByVal asContents)
Dim lnPosition
Dim lsResult
Dim Char1
Dim Char2
Dim Char3
Dim Char4
Dim Byte1
Dim Byte2
Dim Byte3
Dim SaveBits1
Dim SaveBits2
Dim lsGroupBinary
Dim lsGroup64
If Len(asContents) Mod 3 > 0 Then asContents = asContents & String(3 - (Len(asContents) Mod 3), " ")
lsResult = ""
For lnPosition = 1 To Len(asContents) Step 3
lsGroup64 = ""
lsGroupBinary = Mid(asContents, lnPosition, 3)
Byte1 = Asc(Mid(lsGroupBinary, 1, 1)): SaveBits1 = Byte1 And 3
Byte2 = Asc(Mid(lsGroupBinary, 2, 1)): SaveBits2 = Byte2 And 15
Byte3 = Asc(Mid(lsGroupBinary, 3, 1))
Char1 = Mid(sBASE_64_CHARACTERS, ((Byte1 And 252) /4) + 1, 1)
Char2 = Mid(sBASE_64_CHARACTERS, (((Byte2 And 240) /16) Or (SaveBits1 * 16) And &HFF) + 1, 1)
Char3 = Mid(sBASE_64_CHARACTERS, (((Byte3 And 192) /64) Or (SaveBits2 * 4) And &HFF) + 1, 1)
Char4 = Mid(sBASE_64_CHARACTERS, (Byte3 And 63) + 1, 1)
lsGroup64 = Char1 & Char2 & Char3 & Char4
lsResult = lsResult + lsGroup64
Next
Base64encode = lsResult
End Function
%>

  1. No Image 08Feb
    by
    2022/02/08 Views 670 

    ASP에서 페이지의 환경변수(IP,URI,PORT....) 알아내기

  2. No Image 18Jun
    by
    2020/06/18 Views 364 

    해당 경로에서 파일명만 추출

  3. No Image 16Jan
    by
    2019/01/16 Views 1119 

    ADO 컴포넌트 - Fields 컬렉션

  4. No Image 10Jan
    by
    2019/01/10 Views 1293 

    ASP 기본적으로 많이 쓰이는 함수

  5. No Image 27Oct
    by
    2018/10/27 Views 1575 

    ASP JScript 에서 Request 값 받기

  6. No Image 27Oct
    by
    2018/10/27 Views 1937 

    ASP의 EXECUTE, EVAL 사용하기

  7. No Image 11Sep
    by
    2016/09/11 Views 5120 

    asp 에서 간단하게 리사이징 하기..

  8. No Image 01Mar
    by
    2014/03/01 Views 21086 

    성능 및 스타일 향상에 도움이 되는 28가지 ASP 팁

  9. No Image 27Feb
    by
    2014/02/27 Views 5292 

    ASP File Download

  10. No Image 27Feb
    by
    2014/02/27 Views 5919 

    ASP에서 자동가입방지 그림문자 생성기 (CAPTCHA)

  11. No Image 27Feb
    by
    2014/02/27 Views 5439 

    ASP 종료 함수

  12. No Image 27Feb
    by 조쉬
    2014/02/27 Views 5724 

    ASP 에서 패스워드 암호화

  13. No Image 27Feb
    by
    2014/02/27 Views 18877 

    mssql_엑셀파일로 저장/다운받기

Board Pagination Prev 1 Next
/ 1

하단 정보를 입력할 수 있습니다

© k2s0o1d4e0s2i1g5n. All Rights Reserved