mysql aes_encrypted数据比较
I want to compare data encrypted with mysql aes_encrypt() against the encrypted data sent from my app
MySQL version: 10.2.43-MariaDB
Test data: 'abc'
password: '123'
encrypted data sent from my app: 0x911ff5b9a15aae9b52e7e9fde75315b1
The tests table contains one single record and the column varbinary50 contains data encrypted with mysql's aes_encrypt():
CREATE TABLE `tests` (
`test_id` int(11) NOT NULL,
`varbinary50` varbinary(50) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
--
-- Dumping data for table `tests`
--
INSERT INTO `tests` (`test_id`, `varbinary50`) VALUES
(6, 0x911ff5b9a15aae9b52e7e9fde75315b1);
Since varbinary50 contains exactly the value '0x911ff5b9a15aae9b52e7e9fde75315b1', I希望以下查询返回1;取而代之的是0。
select varbinary50='0x911ff5b9a15aae9b52e7e9fde75315b1' from tests
有人可以告诉我我做错了什么吗? tia
I want to compare data encrypted with mysql aes_encrypt() against the encrypted data sent from my app
MySQL version: 10.2.43-MariaDB
Test data: 'abc'
password: '123'
encrypted data sent from my app: 0x911ff5b9a15aae9b52e7e9fde75315b1
The tests table contains one single record and the column varbinary50 contains data encrypted with mysql's aes_encrypt():
CREATE TABLE `tests` (
`test_id` int(11) NOT NULL,
`varbinary50` varbinary(50) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
--
-- Dumping data for table `tests`
--
INSERT INTO `tests` (`test_id`, `varbinary50`) VALUES
(6, 0x911ff5b9a15aae9b52e7e9fde75315b1);
Since varbinary50 contains exactly the value '0x911ff5b9a15aae9b52e7e9fde75315b1', I expect following query to return 1; instead it's 0.
select varbinary50='0x911ff5b9a15aae9b52e7e9fde75315b1' from tests
Could someone tell me what I did wrong? TIA
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
解决方案:将十六进制应用于Varbinary50并从数据中删除“ 0x”前缀
Solution: apply hex to varbinary50 and remove "0x" prefix from the data