问题描述
我的字符串很长(大约50个字符),需要插入数据库中.
但是,数据库中的字段长度只有10个字符(我无法更改它!)
我知道应该有一种哈希或加密字符串的方法,以便可以缩短它,然后以后我想再次使用字符串时应该解密.
最好的方法是什么?
请注意,安全性并不重要,我需要将其转换为简短的另一组字符,并且可以将其转换回原始字符串.
我正在寻找一个C#解决方案.
I have a long string (around 50 characters)and need to insert into database.
however, the length of field in database is only 10 characters (i cannot change it !!)
i know there should be a way to hash or encrypt the string so it can be shorten, then later i should decrypt when i want to use string again.
what is the best way to do this?
please note security is not important and all i need to convert it to another set of characters which are short and i can convert it back to original string.
I am looking for a c# solution.
appreciate your response in advance.
推荐答案
这篇关于从长字符串创建短字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!