承接国内外服务器租用托管、定制开发、网站代运营、网站seo优化托管接单、网站代更新,新老站点皆可!!咨询QQ:3787320601
当前位置:首页  >  互联网圈  >  数据:APP数据怎么加密

数据:APP数据怎么加密

管理员 2023-03-30 09:54:04 互联网圈 44 ℃ 0 评论 1402字 收藏

APP数据怎样加密

APP数据如何加密

对APP数据进行加密的方法有以下几种

1.MD5加密

使用方法:

import hashlib

s = '你好,世界!'

s = s.encode("utf⑻")

m = hashlib.md5()

m.update(s)

psw = m.hexdigest()

2.base64加密

使用方法:

import base64

s = '你好,世界!'

s = s.encode("utf⑻")

s1 = base64.encodestring(s)

s2 = base64.decodestring(s1).decode("utf⑻")

print("原始数据:",s2)

print("base64:",s1)

3.bcrypt加密

使用方法:

import bcrypt

paswd = "YUjun"

password = paswd.encode("utf⑻")

hashed = bcrypt.hashpw(password,bcrypt.gensalt())

print(password)

print(hashed)

if bcrypt.hashpw(password,hashed) == hashed:

print("It maches!")

else:

print("It does not match:(")

4.AES加密

使用方法:

from Crypto.Cipher import AES

obj = AES.new('This is a key123', AES.MODE_CBC, 'This is an IV456')

message = "The answer is no"

ciphertext = obj.encrypt(message)

print(ciphertext)

obj2 = AES.new('This is a key123', AES.MODE_CBC, 'This is an IV456')

print(obj2.decrypt(ciphertext))

文章来源:丸子建站

文章标题:数据:APP数据怎么加密

https://www.wanzijz.com/view/5502.html

TAG: 数据加密

相关文章

Related articles

X

截屏,微信识别二维码

微信号:weimawl

(点击微信号复制,添加好友)

打开微信