什么是最有效的方式来连接code任意GUID成可读的ASCII(33-127)?最有效、可读、方式、code

由网友(擱淺、呐囘憶°)分享简介:GUID的标准字符串重新presentation大约需要36个字符。这是非常好的,但也确实浪费。我想知道,如何连接code它使用所有ASCII字符的范围33-127最短的途径。天真的实现产生22个字符,仅仅是因为 128位 / 6位收益率22。The standard string representation...

GUID的标准字符串重新presentation大约需要36个字符。这是非常好的,但也确实浪费。我想知道,如何连接code它使用所有ASCII字符的范围33-127最短的途径。天真的实现产生22个字符,仅仅是因为 128位 / 6位收益率22。

The standard string representation of GUID takes about 36 characters. Which is very nice, but also really wasteful. I am wondering, how to encode it in the shortest possible way using all the ASCII characters in the range 33-127. The naive implementation produces 22 characters, simply because 128 bits / 6 bits yields 22.

霍夫曼编码是我的第二个最好的,唯一的问题是如何选择codeS ......

Huffman encoding is my second best, the only question is how to choose the codes....

任何更多的想法?

感谢。

P.S。

编码必须是无损的,当然。

The encoding must be lossless, of course.

推荐答案

使用基地85。 参见4.1节。 为什么85?的的 IPv6的一个契约再presentation地址

Use Base 85. See section 4.1. Why 85? of A Compact Representation of IPv6 Addresses

这是IPv6地址,就像一个GUID是由8个16位部分。

An IPv6 address, like a GUID is made up of eight 16-bit pieces.

阅读全文

相关推荐

最新文章