完善哈希函数混淆顺序值

编程入门 行业动态 更新时间:2024-10-26 23:38:33
本文介绍了完善哈希函数混淆顺序值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

下面是我需要的(语言:C#4):

我建立一个系统,你可以提出申诉。已提交的投诉后,您将得到识别系统投诉独特的9位数字。

有关安全性(安全透过朦胧)的目的,我不想票的ID是连续的。但我的做要使用数据库来生成顺序编号。

所以,我需要的是一个射功能是快速两种方式:序列号,我的票号,从票号回序列号

所以,在数据库中我的 ticketId 是连续的,但显示给用户之前,我会混淆这,同样,当我得到了多少回,从用户,我去混淆它,并用它来查找投诉到数据库中。

混淆的部分并不需要太复杂,只是看不出来足够的为普通大众。

例如,我可以简单地改变值的位数,这将让我(8位值):

  

0 - > 0   1 - > 128   2 - > 192   3 - > 64   4 - > 160   5 - > 96

     

等。

解决方案

我想你可以解决这个问题很好:加密的票号以恒定的关键。 There是一个32位的块大小的块加密,您可以使用。

Here is what I need (language: C# 4):

I am building a system where you can submit complaints. After complaint has been submitted you are given a unique 9 digits number that identifies your complaint in the system.

For security (security through obscurity) purposes I do not want ticket IDs to be sequential. But I do want to use database to generate sequential id.

So what I need is a injective function that is fast both ways: sequential number to my ticket id, and back from ticket id to the sequential number.

So that my ticketId in database is sequential, but before showing it to a user I will obfuscate it, similarly, when I get a number back from the user, I de-obfuscate it and use it to look up complaint in the database.

The obfuscation part does not need to be too complicated, just "not apparent enough" for general public.

For example I could simply change bitness of the value, which will get me (for 8-bit values):

0 -> 0 1 -> 128 2 -> 192 3 -> 64 4 -> 160 5 -> 96

etc.

解决方案

I think you can solve this problem perfectly: Encrypt the ticket number with a constant key. There is a 32-bit block-size block cipher that you can use.

更多推荐

完善哈希函数混淆顺序值

本文发布于:2023-11-23 09:01:13,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1620855.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:函数   顺序

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!