这是一个简单的但稍微有效方式至"模糊处理"数值?这是一个、数值、模糊、有效

2023-09-11 07:12:42 作者:问世间谁能敌我

让我们说我有一个Access数据库表中,有2列:一是ID(从1到20000,按顺序每个都是独一无二的),一个是值(任何数字从0到500)

Let's say I have an Access database table that has 2 columns: one is ID (from 1 to 20000, sequentially and each is unique) and one is Value (any number from 0 to 500).

我如何混淆在 简单的但有些有效的方式值字段(使用ID或不使用ID)?我预计,decoing需要多行的code的东西稍微比ROT13混淆更有效,但没那么复杂。解码是用C#code完成。混淆是通过计算领域的访问完成的。

How do I obfuscate the Value field (using ID or not using ID) in a simple but somewhat effective way? I expect something slightly more effective than ROT13 obfuscation but not so complicated that decoing needs more than one line of code. The decoding is done in C# code. The obfuscation is done via calculated field in Access.

我改变了加密,以混淆,以反映这并不是prevent攻击,但只是为了避免数据的不小心暴露了目标的简单性。

I changed the "encryption" to "obfuscation" to reflect the simplicity of the goal which is NOT to prevent "attack" but only to avoid careless exposure of data.

推荐答案

什么是你的目标/攻击者的个人资料?如果你的需求是什么,更不是停止随意观看你IMPOSIBLE要求...如果你只关心制止随意观看(这是更好地称为模糊处理比加密),你可以尝试像

what is your goal/attacker profile? If your requirement is anything more than stopping casual viewing you have imposible requirements... if you only care about stopping casual viewing (which is better termed obfuscation than encryption) you could try something like

B = A%7 == 0? ((A / 7)* 991):%2 == 0? ((A / 2)* 787):A * 317

和在另一端

B = A%991 == 0? ((A / 991)* 7):一%787 == 0? ((A / 787)* 2):A / 317

请注意,这是非常弱的,但是你的要求不包括加密的任何有用的形式。

Note that this is very weak but your requirements exclude any useful form of encryption.