Home  >  Article  >  Backend Development  >  关于php如何解密.net加密后数据库里面的内容和文件

关于php如何解密.net加密后数据库里面的内容和文件

WBOY
WBOYOriginal
2016-06-20 12:35:431146browse

   公司原网站使用的是.net,现在让我用php改版,现在需要将原来的数据库导出来,发现导出来的都是2进制数据,已知他们使用的HttpPostedFile.InputStream将整个文件及内容保存为2进制流存放的,又说是读取的字节(我没听懂),请问我该怎么搞?求指点


回复讨论(解决方案)

什么样的数据?至少应截个图

转化后的东西太长,所以没有截图
这个是我摘的某个数据(论坛字符限制,只发一小部分)
0x424D465C0C0000000000360000002800000058020000C20100000100180000000000105C0C00000000000000000000000000000000004132AB4132AB4132AB4132AB4132AB4132AB4132AB4132AB4132AB4334AD4334AD4132AB3E2FA83D2EA73F30A93E31B13D32C43B31CB3D33CD3E34CE3F34D03E33CF3E33D03D32CF3D32CF3D32CF3D31D13D31D13D30D23D30D23D30D23D31D13F30D13F32CE3F32CA3F33C94031C84031C8412FC84131C54431C34232BB4133B13F32AC4132AC4231B04530B54331BA3F31B83C33B93D33BB3F35BD4134C04134C04033BF4033BF4334BE4234BC4333BC4234B84032B63F31B44132B24030B33D2DB64131BE4434C74337CD4035D23D32D43E33D74034DA4231D84231D84...

0x424D465C0C0......
这样表示的是一个十六进制数的字符串

你可在读取后去掉前面的 0x 后,用 pack 函数还原出原始内容
$s = pack('H*', substr($s, 2));

你示例的是一个 BMP 图片数据

这个我以前试看到过,不过当时用的是C,现在我用H或者C都是同样的乱码问题,始终解决不了,网上资料介绍说是编码问题,我主要的编码都试过了,还是不行,不知道咋办

虽然没有解决问题,还是谢谢你

尽管你只贴出了数据片段,但仍然能看到你的数据时一个 BMP 图片

$s = '424D465C0C0000000000360000002800000058020000C20100000100180000000000105C0C00000000000000000000000000000000004132AB4132AB4132AB4132AB4132AB4132AB4132AB4132AB4132AB4334AD4334AD4132AB3E2FA83D2EA73F30A93E31B13D32C43B31CB3D33CD3E34CE3F34D03E33CF3E33D03D32CF3D32CF3D32CF3D31D13D31D13D30D23D30D23D30D23D31D13F30D13F32CE3F32CA3F33C94031C84031C8412FC84131C54431C34232BB4133B13F32AC4132AC4231B04530B54331BA3F31B83C33B93D33BB3F35BD4134C04134C04033BF4033BF4334BE4234BC4333BC4234B84032B63F31B44132B24030B33D2DB64131BE4434C74337CD4035D23D32D43E33D74034DA4231D84231D84';$s = pack('H*', $s);$FILE = unpack ( "vfile_type/Vfile_size/Vreserved/Vbitmap_offset" , substr($s, 0, 14 ));print_r($FILE);$BMP = unpack ( 'Vheader_size/Vwidth/Vheight/vplanes/vbits_per_pixel' . '/Vcompression/Vsize_bitmap/Vhoriz_resolution' . '/Vvert_resolution/Vcolors_used/Vcolors_important' , substr( $s, 14, 40 )); print_r($BMP);
Array(    [file_type] => 19778    [file_size] => 810054    [reserved] => 0    [bitmap_offset] => 54)Array(    [header_size] => 40    [width] => 600    [height] => 450    [planes] => 1    [bits_per_pixel] => 24    [compression] => 0    [size_bitmap] => 810000    [horiz_resolution] => 0    [vert_resolution] => 0    [colors_used] => 0    [colors_important] => 0)

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Previous article:sql保存数据出错Next article:php-SPL库迭代器类