문제

I'm trying to implement in PHP something similar to Jeff Atwood's Equipping our ASCII armor. Here's C# Implementation of ASCII85.

Here's PHP Implementation of ASCII85

Here's how I convert the string to byte array:

$byteArr = str_split($uid);
foreach ($byteArr as $key=>$val) {
     $byteArr[$key] = ord($val); 
}

And what? now :) How to encode this byte array using ASCII 85 to get shorter UID?

올바른 솔루션이 없습니다

다른 팁

It depends on the PHP implementation (your link is not working).

If you use this one, then the code is easy:

<?php
include("ascii85.php"); 

$a = new ASCII85();
$uid = "YOUR-UID-AS-A-STRING"; 

$en = $a->encode($uid); 
$de = $a->decode($en); 

echo $en."\n\n".$de; 
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top