PHP中的双向加密 [英] Two-way encryption in PHP
问题描述
我的应用程序(显然)使用唯一的ID来区分记录。这个UID在URL中传递(例如 ./ examplepage.php?UID = $ example_int
)等等。
My application (obviously) uses a unique ID to distinguish records. This UID is passed in URLs (e.g. ./examplepage.php?UID=$example_int
), among other things.
虽然我显然有服务器端验证,以确保客户端不访问其他客户端的数据,是否有双向加密方法,我可以在PHP中使用只传递加密的UID(例如 ./ examplepage.php?EUID = $ encrypted_int
),以进一步减少任何人认为嘿,如果我增加这个整数会怎么样的机会?
While I obviously have server-side validation in place to make sure clients don't access other clients' data, is there a two-way encryption method I can use in PHP to only pass encrypted UIDs (e.g. ./examplepage.php?EUID=$encrypted_int
), to further reduce the chance of anyone thinking "hey, what happens if I increment this integer?"
TIA。
推荐答案
在ID旁边放置一个哈希,以确保其安全性,或者用额外的ID填充ID数据,甚至将ID转换为十六进制,这一切都会运行得很好,我想。
Placing a hash next to the ID to ensure it's security, or padding the ID with extra data, or even converting the ID to hex would all work fairly well I think.
这篇关于PHP中的双向加密的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!