21 lines
652 B
Python
21 lines
652 B
Python
from django.shortcuts import render, HttpResponse
|
|
from apps.api.common import CaesarCypherClass, Base64CypherClass
|
|
|
|
|
|
# Create your views here.
|
|
def home(request):
|
|
bs64 = Base64CypherClass()
|
|
s = request.GET.get('s')
|
|
print(s)
|
|
s_encode = bs64.base64_encode_str(bs64,s)
|
|
print(s_encode)
|
|
s_decode = bs64.base64_decode_str(bs64,s)
|
|
|
|
# s_encode = bs64.base64_encode_pic(bs64, s)
|
|
# if s_encode != "图片路径不存在":
|
|
# s_decode = bs64.base64_decode_pic(bs64, s_encode)
|
|
# else:
|
|
# s_decode = ''
|
|
# return HttpResponse(f"解密:{s_decode}")
|
|
return HttpResponse(f"加密:{s_encode}\n解密:{s_decode}")
|