又是一年 0 和 1 的好时节,全国程序猿现同台打 CALL,由各路程序猿响应监制,集加班、加班和加班于一体的《 1024 》在全国范围内同步上映。
这么一个不安分的节,POLYV 程序小编们粗来搞事情啦~
登登登,这是一道由 Java、JS、C++、Objective C 的同事用半根白发换来的题。解出题目的猿儿们将有机会获得蓝牙耳机一副!
兄弟姐妹,敢来挑战手动解题、拾取你的小幸运吗?
** [活动规则] **
以下四种语言的代码中含有相应的加密暗语,您可以从中选取其中一组代码对暗语进行解密,并以 “您的昵称+解密所得暗语+PolyV ”(不含引号及加号,注意大小写噢) 所得的字符串进行 MD5 运算,然后在本帖下方回复 您最终所得的 MD5 串。
我们将在活动结束后从回帖中随机抽出 5 位通过验证的幸运儿,送上精美礼品一份~
===============以下为四种语言代码===============
1、Java(需使用 commons-codec-1.10.jar 包)
package com.rode.main;
import java.io.UnsupportedEncodingException;
import java.util.Scanner;
import org.apache.commons.codec.binary.Base64;
import org.apache.commons.codec.digest.DigestUtils;
public class Entrance {
private static final String POLYV_PROPAGANDA = "RXN0YWJsaXNoZWQgaW4gMjAxMiwgR3Vhbmd6aG91IEVhc3lmdW4gSW5mb3JtYXRpb24gVGVjaG5vbG9neSBDby4sIEx0ZC4gaXMgYSBuYXRpb25hbC1jZXJ0aWZpY2F0ZWQgaGlnaC10ZWNoIGNvbXBhbnksIHdoaWNoIHRoZSBjb3JlIG1lbWJlcnMgYXJlIGZyb20gdG9wLXJhbmtpbmcgaW50ZXJuZXQgY29ycG9yYXRpb25zIGxpa2UgTmV0ZWFzZSwgQWxpYmFiYSBhbmQgQmFpZHUuIFByb3ZpZGluZyBWaWRlbyBDbG91ZCBhbmQgTGl2ZSBTdHJlYW1pbmcgQ2xvdWQgc2VydmljZXMgZm9yIGJ1c2luZXNzLCBQT0xZViBpcyBib3JuIGludG8gYSBzdWNoIGEgZ3JlYXQgY29tcGFueS4=";
private static final String POLYV_MD5_PART = "PolyV";
public static void main(String[] arges) {
try {
byte[] decode = Base64.decodeBase64(POLYV_PROPAGANDA.getBytes("UTF-8"));
String decodeStr = new String(decode, "UTF-8");
System.out.print("Please input your nick name: ");
Scanner str = new Scanner(System.in);
String input = str.next();
System.out.println(decodeStr);
System.out.println("MD5: " + md5Hex(input + decodeStr + POLYV_MD5_PART));
str.close();
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
}
/**
* md5 encrypt
* @param text to be encrypted.
* @return the encrypted result.
*/
public static String md5Hex(String text) {
return DigestUtils.md5Hex(text);
}
}
2、C++
/*****************************************Festival.h*****************************************/
#include "ui_Festival.h"
#include <qcryptographichash.h>
class Festival : public QMainWindow
{
Q_OBJECT
public:
Festival(QWidget *parent = Q_NULLPTR);
private:
Ui::FestivalClass ui;
private slots:
void on_generateBtn_clicked();
};
/*****************************************Festival.cpp*****************************************/
#include "Festival.h"
#include <qcryptographichash.h>
#define QT_UTF8(str) QString::fromUtf8(str)
#define QT_TO_UTF8(str) str.toUtf8().constData()
Festival::Festival(QWidget *parent)
: QMainWindow(parent)
{
ui.setupUi(this);
this->setFixedHeight(120);
this->setFixedWidth(500);
ui.plainTextEdit->setReadOnly(true);
this->setStyleSheet("background-color: #ffffff");
ui.encryNickNameLbl->setStyleSheet("font: bold; font-size:20px; color:red; ");
ui.plainTextEdit->setStyleSheet("font: bold; font-size:14px; color: #26a0f5; ");
ui.generateBtn->setStyleSheet("font: bold; color:#26a0f5;font-size:14px; border:1px solid #26a0f5; ");
ui.nickNameEdit->setStyleSheet("border:1px solid #26a0f5;font:normal 14px Microsoft YaHei;color:#5f7958;");
ui.nickNameLbl->setStyleSheet("font: bold; color:#26a0f5;font-size:14px; ");
}
void Festival::on_generateBtn_clicked()
{
this->setFixedHeight(300);
this->setFixedWidth(500);
char val[] = { 32 ,43, 86, 120, 0157, 0154, 160, 0171, 33, 0157, 0154, 125, 0163, 127, 0120};
QString nickNameStr = ui.nickNameEdit->text().trimmed();
std::string val1 = val;
QString val2 = val1.c_str();
QString val3 = val2.mid(14, 1) + val2.mid(9, 2) + val2.mid(7, 1) + val2.mid(2, 2);
QString generateCode64Str =QStringLiteral("UE9MWVYgaXMgdGhlIGNsb3VkIGNvbXB1dGluZyBwbGF0Zm9ybSBmdWxseSBvd25lZCBieSBFYXN5ZnVuLCBpbmNsdWRpbmcgVmlkZW8gQ2xvdWQsIExpdmUgU3RyZXdpbmcgQ2xvdWQgYW5kIG90aGVyIHZpZGVvIHNlcnZpY2VzLiBXaXRoIGNvbXBsZXRlIHNldHMgb2YgQVBJLCBTREsgYW5kIGRldmVsb3BlciBkb2N1bWVudHMsIHRoZSBuYXRpb25hbC1wYXRlbnRlZCBQbGF5U2FmZSBEUk0gRWNvc3lzdGVtLCBQT0xZViBkZWxpdmVycyBzdGFibHkgc2FmZSBkaXRkIHNwZWVkeSB2aWRlbyBzZXJ2aWNlIGZvciBidXNpbmVzcyBhbmQgZW50ZXJwcmlzZSB1c2Vycy4=");
QString generateCodeStr = QByteArray::fromBase64(generateCode64Str.toUtf8());
QString signStr = QString("%1%2%3").arg(nickNameStr).arg(generateCodeStr).arg(val3.mid(0, 5));
QString md5String = QCryptographicHash::hash(QT_TO_UTF8(signStr), QCryptographicHash::Md5).toHex();
//Show MD5 String
ui.encryNickNameLbl->setText(md5String);
//Generate Code Str
ui.plainTextEdit->setPlainText(generateCodeStr);
}
3、JS
var nickname = "1024"; // 您的昵称
var str = 'V2l0aCB0aGUgdmlzaW9uIG9mICJkcml2aW5nIHZpZGVvIHdpdGggdmFsdWUiLFBPTFlWIG5vdyBwcm92aWRlcyBncmVhdCB2aWRlbyBwcm9kdWN0cyBpbmNsdWRpbmcgVmlkZW8gQ2xvdWQgYW5kIExpdmUgU3RyZWFtaW5nIENsb3VkIGZvciBidXNpbmVzcyB1c2Vycy5DdXJyZW50bHksIG92ZXIgMzcsMDAwIGNvcnBvcmF0aW9ucyBhbmQgb3JnYW5pemF0aW9ucyBhcmUgdXNpbmcgUE9MWVbigJlzIHZpZGVvIHNlcnZpY2UsIGdhaW5pbmcgaGlnaCByZXB1dGF0aW9uIGFtb25nIG9ubGluZSBlZHVjYXRpb24gaW5kdXN0cnkgYXMgd2VsbCBhcyBkb21lc3RpYyBhbmQgaW50ZXJuYXRpb25hbCBjbGllbnRzIGxpa2UgQXNpYW4gSW5mcmFzdHJ1Y3R1cmUgSW52ZXN0bWVudCBCYW5rIChBSUlCKSwgQ0NUViwgRGVsbCwgQm9zY2ggJiBTaWVtZW5zIEhvbWUgQXBwbGlhbmNlcyAoQlNIKSBhbmQgTGlua2VkaW4u';
var b = new Base64();
str = b.decode(str);
console.log(str);
var code = "";
var val = [80,111,108,121,86,127,136,102];
for (var i = 0; i < val.length; i++) {
code += String.fromCharCode(val[i]);
}
code = code.substring(0,5);
var sign = hex_md5(nickname + str + code);
console.log(sign);
4、Objective C
```Objective-C
// 您的昵称
NSString *nickName = @"";
NSString *EncodeStr = @"UE9MWVYsIGEgY2xvdWQgY29tcHV0aW5nIHBsYXRmb3JtIHdpdGggdmlkZW8gcHJvZHVjdHMsIGhhcyBub3cgZGV2ZWxvcGVkIDE1NyBmZWF0dXJlcyBmb3IgVmlkZW8gQ2xvdWQsIGFuZCAyMDggZm9yIExpdmUgU3RyZWFtaW5nIENsb3VkICh3aXRoIDEwMiB0YWlsb3JlZCBmb3IgZWR1Y2F0aW9uIGluZHVzdHJ5KS4gV2l0aCB0aGUgY29taW5nIG9mIDExLjExLCBhbmQgaW4gYWNjb3JkYW5jZSB3aXRoIHRoZSBwcm9tb3Rpb24gaXNzdWVzLCBQT0xZViB3aWxsIHByb3ZpZGUgZXhjbHVzaXZlIGRpc2NvdW50cyBvZiB0aGUgeWVhciwgYW5kIHJlbGVhc2Ugc2VydmljZSB1cGRhdGVzIGF0IHRoZSBzYW1lIHRpbWUu";
NSData *decodeData = [GTMBase64 decodeString:EncodeStr];
NSString *content = [[NSString alloc] initWithData:decodeData encoding:NSUTF8StringEncoding];
NSString *key = [[content substringToIndex:4] capitalizedString];
NSString *combinationStr = [nickName stringByAppendingFormat:@"%@%@V",content,key];
NSString *sign = [PLVUtil md5HexDigest:combinationStr];
NSLog(@"%@\n%@",content,sign);
```
===============代码环节结束分割线===============
顺便宣布一件大事,距举国关注的双十一还有不到 20 天,云视频服务商保利威视在双十一也将推出全年最低价的云视频大聚惠,敬请期待! ** [正经脸] **
** [活动方] **
保利威视是国内领先的视频云计算服务平台。站在云点播、云直播的技术前沿,帮助企业通过视频创造巨大的商业应用价值。欢迎进入保利威视官网了解视频加密原理和丰富的视频技术应用: http://www.polyv.net/
** [福利] **
1、奖品:蓝牙耳机一副(共 5 份)
2、所有参与活动的人都可获得一个大礼包:注册保利威视获“点播流量 12G+空间 4G、一年测试期、全功能开放”+“ 1 万直播分钟数” (礼包限 11 月份前注册有效)
** [中奖规则] **
1、活动时间:10 月 24 日 00:00 ~ 10 月 29 日 24:00
2、使用随机数生成器抽出 5 位验证正确的中奖者,于活动结束后公布,并在活动结束一周内寄出奖品;
3、活动主办方在法律允许的范围内,保留此次活动的最终解释权。
这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。
V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。
V2EX is a community of developers, designers and creative people.