整数代码和返回 [英] Integer to code and back

查看:96
本文介绍了整数代码和返回的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要将整数转换为仅包含

大写字母和数字的唯一代码字符串。

我还需要能够将其转换回再次整数。


例如:


10 = DFG56JKG4 = 10


谷歌搜索没有帮助。


问候

解决方案

2007年1月3日星期三19:05:14 +0100,Tom写道:


我需要将一个整数转换为一个唯一的代码字符串

大写字母和数字。

我还需要能够将它再次转换回整数。


示例:


10 = DFG56JKG4 = 10

如何实现这一目标?

谷歌搜索没有帮助。 />

问候



用于从整数映射到字符串的逻辑是什么?


-----开始PGP签名消息-----

哈希:SHA1


Dan M写道:


2007年1月3日星期三19:05:14 +0100,Tom写道:


> 10 = DFG56JKG4 = 10

我该如何做到这一点?



用于从整数映射到字符串的逻辑是什么?



我想汤姆完全不知道怎么做。


可行的可能性:

- - 哈希表。

- - 一个simetric加密功能。


- -

- - --------------------------------

Iv ?? n S ?? nchez Ortega - ivansanchez-algarroba-escomposlinux-punto-org-
http://acm.asoc.fi.upm.es/~mr/ ; http://acm.asoc.fi.upm.es/~ivan /

MSN:我_ ************************* @ hotmail.com

Jabber:iv ********* @ jabber.org; iv*********@kdetalk.net

- ----开始PGP签名-----

版本:GnuPG v1.4.6(GNU / Linux)

iD8DBQFFnAFRR56dWuhgxGgRAtXIAKCC1sid + P5QVExaUxpJF0 pGqpyhoACfYoA7
UhwYA0Cl03R6ZUwG + 8C1jMw =

= K7s3

----- END PGP SIGNATURE -----


>>


>用于从整数映射到字符串的逻辑是什么?



我想汤姆完全不知道如何做到这一点。



完全正确!


我有triede base64_decode / encode但它失败了,因为它使用了非

alphanumerics。

所以base32


可行的可能性:

- - 哈希表。



嗯不响铃,谷歌给了我大量的东西,而不是直接相关的b $ b。

你能给我一个伪代码的例子吗?


- - 一个simetric加密函数。



嗯,谷歌搜索时的结果相同。这个概念存在,但显然每个人都知道它很好,他们不解释它,但只是参考它:-D

请举个例子?


感谢您的回答!


Tom


I need to convert an integer to a unique code string consisting only of
capital letters and numbers.
I also need to be able to convert it back to an integer again.

Example:

10 =DFG56JKG4 =10

How do I accomplish that?
Googling has not helped.

Regards

解决方案

On Wed, 03 Jan 2007 19:05:14 +0100, Tom wrote:

I need to convert an integer to a unique code string consisting only of
capital letters and numbers.
I also need to be able to convert it back to an integer again.

Example:

10 =DFG56JKG4 =10

How do I accomplish that?
Googling has not helped.

Regards

What is the logic used to map from integer to string?


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Dan M wrote:

On Wed, 03 Jan 2007 19:05:14 +0100, Tom wrote:

>10 =DFG56JKG4 =10

How do I accomplish that?


What is the logic used to map from integer to string?

I guess that Tom has absolutely no idea on how to do that.

Viable possibilities:
- - A hash table.
- - A simetric encryption function.

- --
- ----------------------------------
Iv??n S??nchez Ortega -ivansanchez-algarroba-escomposlinux-punto-org-

http://acm.asoc.fi.upm.es/~mr/ ; http://acm.asoc.fi.upm.es/~ivan/
MSN:i_*************************@hotmail.com
Jabber:iv*********@jabber.org ; iv*********@kdetalk.net
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)

iD8DBQFFnAFRR56dWuhgxGgRAtXIAKCC1sid+P5QVExaUxpJF0 pGqpyhoACfYoA7
UhwYA0Cl03R6ZUwG+8C1jMw=
=K7s3
-----END PGP SIGNATURE-----


>>

>What is the logic used to map from integer to string?


I guess that Tom has absolutely no idea on how to do that.

Exactly!

I have triede base64_decode / encode but it fails as it uses non
alphanumerics.
So does base32

Viable possibilities:
- - A hash table.

Hmm doesn''t ring a bell, and google gives me oodles of stuff that is not
directly related.
Could you please provide me with an example in pseudo code or something?

- - A simetric encryption function.

Well, same result when googling. The concept exists but apparently everybody
knows it so well they don''t explain it but just refer to it :-D
An example please?

Thanks for answering!

Tom


这篇关于整数代码和返回的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆