我在mysql服务器5.5.38
上遇到mysql加密问题如果我这样做:
SELECT AES_DECRYPT(AES_ENCRYPT("test", "123"), "123");
结果是74657374
我在mysql doc中看到DECODE()和ENCODE()已被弃用,我们鼓励使用AES函数:
ENCODE()和DECODE()函数在MySQL 5.7中已弃用,将在未来的MySQL版本中删除,不应再使用。请考虑使用AES_ENCRYPT()和AES_DECRYPT()。
注意:当我使用SELECT DECODE(ENCODE(&#34; test&#34;,&#34; 123&#34;),&#34; 123&#34;)时,结果是相同的:74657374 < / p>
答案 0 :(得分:1)
答案 1 :(得分:0)
它正常工作。
74657374是字符串的十六进制表示&#39; test&#39;:
unhex
尝试使用SELECT UNHEX(AES_DECRYPT(AES_ENCRYPT("test", "123"), "123"));
:
var BroChart = (function(){
"use strict";
function Point(x, y){
this.coordinates = [x, y];
}
function Series(label){
this.pointArray = [];
this.label = label;
}
// method to add single point
function addPoint(series, point) {
if (point instanceof Point) {
series.pointArray.push(point.coordinates);
} else {
console.log('Error: not a valid point');
}
}
// method to add array of points
function addPoints(series, points) {
points.forEach(function(point) {
if (point instanceof Point) {
series.pointArray.push(point.coordinates);
} else {
console.log('Error: not a valid point');
}
});
}
function Chart(title, data, type){
this.title = title;
this.data = data;
this.type = type;
this.printSeries = function() { _printSeries(this); };
}
//prototype method in question
Chart.prototype.printSeries2 = function() {
console.log(this.title + ' Chart');
console.log('Type: ' + this.type);
console.log('Data Points: ' + this.data.pointArray);
};
function addSeries(chart, series) {
if (series instanceof Series) {
chart.data.push(series.pointArray);
} else {
console.log('Error: not a valid series');
}
}
function _printSeries(chart) {
console.log(chart.title + ' Chart');
console.log('Type: ' + chart.type);
console.log('Data Points: ' + chart.data.pointArray);
}
//revealing module pattern
return {
Point: Point,
Series: Series,
Chart: Chart,
addPoint: addPoint,
addPoints: addPoints,
addSeries: addSeries
};
})();
var broSeries = new BroChart.Series('Protein vs. Sick Gainz');
var firstPoint = new BroChart.Point (343, 21);
var secondPoint = new BroChart.Point (2, 11);
var thirdPoint = new BroChart.Point (54, 241);
var fourthPoint = new BroChart.Point (76, 988);
BroChart.addPoint(broSeries, firstPoint);
BroChart.addPoints(broSeries, [secondPoint, thirdPoint, fourthPoint]);
var Bro = new BroChart.Chart('Protein vs. Sick Gainz', broSeries, 'line');
Bro.printSeries(Bro);
//problematic prototype method call
Bro.printSeries2();