捏脸游戏是如何使用png来隐藏信息的

阅读: 评论:0

捏脸游戏是如何使用png来隐藏信息的

捏脸游戏是如何使用png来隐藏信息的

原文链接: 捏脸游戏是如何使用png来隐藏信息的

上一篇: to the moon中的小游戏

下一篇: 生成指定长度和进制的BigInt

虽然有点好奇, 但基本上还是有点头绪的, 之前用png来隐藏视频文件, 通过压缩的方式隐藏

不知道有没有修好

这次是通过在png文件格式尾附加实现

1, 图片压缩很重要, 不只是为了减少存储大小, 而且是为了向这种方式进行隐秘的信息存储

2, 简单的信息使用这种方式隐藏很方便, 不必使用zip或者两个文件分别维护, 甚至可以加入秘钥等身份鉴别信息

在下面的图片中, 添加隐藏信息, 诸如名字, 身高等

png文件结构

.html

字符串和buffer的一些操作

const s = "12345678";
const c = "45";
const i = s.indexOf(c);
console.log(i);
console.log(s.slice(0, i + c.length));
console.log(s.slice(i + c.length));console.log(Buffer.from("HoneySelectCharaFemale").toString("hex").toLowerCase()
);const h2 ="3247dc7e889f3775a08e6d23c9404b8e82694e17ef9b27868aef8c61e284279e077d0200000000000903000000000000";
console.log(Buffer.from(h2, "hex").toString('utf8'));

简单来讲就是读图片, 转换为hex格式, 然后从png尾部分割为png和txt两端, 重新写到两个文件中,完成图片和信息的分离

const fs = require("fs");
const str = fs.readFileSync("./hs/t.png");
const hex = String("hex");
fs.writeFileSync("./h.txt", hex);
const end = "AE 42 60 82".replace(/s+/gis, "").toLowerCase();
console.log("end", end, hex.includes(end));
if (hex.includes(end)) {const i = hex.indexOf(end);const png = hex.slice(0, i + end.length);const text = hex.slice(i + end.length);console.log("png", png.length);console.log("text", text.length);const txtBuffer = Buffer.from(text, "hex");console.String('utf8'))fs.writeFileSync("./", txtBuffer, "utf8");const pngBuffer = Buffer.from(png, "hex");fs.writeFileSync("./png.png", pngBuffer);
}

成功分离后图片没有损坏, 不过数据不知道什么格式, 只能读一部分

这个应该是标示自定义数据的开头, 后面就是附加的隐藏数据了

本文发布于:2024-02-05 05:43:07,感谢您对本站的认可!

本文链接:https://www.4u4v.net/it/170725455063537.html

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。

标签:如何使用   游戏   信息   png
留言与评论(共有 0 条评论)
   
验证码:

Copyright ©2019-2022 Comsenz Inc.Powered by ©

网站地图1 网站地图2 网站地图3 网站地图4 网站地图5 网站地图6 网站地图7 网站地图8 网站地图9 网站地图10 网站地图11 网站地图12 网站地图13 网站地图14 网站地图15 网站地图16 网站地图17 网站地图18 网站地图19 网站地图20 网站地图21 网站地图22/a> 网站地图23