douci1677 2015-05-28 08:42
浏览 114

PHP,如何在不丢失信息的情况下缩短字符串

I'm using codeigniter 3 ecryption library with default settings from the codeigniter PHP framework to crypt some simple alphanumeric strings.

Here's a small example on how it works inside a codeigniter helper:

<?php
    function shortCrypt($string) {
        $CI =& get_instance();
        $CI->load->library('encryption');
        return $CI->encryption->encrypt($string);
    }

The returned crypted string is too long for my purposes and i would like to make it shorter without losing any information. I thought to pass the AES-128 crypted string via md5 to reach a 32 characters lenght but the only problem is i can't obtain the original string back.

Is there a way to "compress" the AES-128 crypted string to obtain a shorter one without losing the original?

Sorry for my bad english.

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥50 求图像处理的matlab方案
    • ¥50 winform中使用edge的Kiosk模式
    • ¥15 关于#python#的问题:功能监听网页
    • ¥15 怎么让wx群机器人发送音乐
    • ¥15 fesafe材料库问题
    • ¥35 beats蓝牙耳机怎么查看日志
    • ¥15 Fluent齿轮搅油
    • ¥15 八爪鱼爬数据为什么自己停了
    • ¥15 交替优化波束形成和ris反射角使保密速率最大化
    • ¥15 树莓派与pix飞控通信