捕获一道难度系数为 0.6 的程序题,解开有重奖!!

2017-10-24 00:06:56 +08:00
 lyver

又是一年 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、活动主办方在法律允许的范围内,保留此次活动的最终解释权。

7223 次点击
所在节点    推广
78 条回复
nomoon
2017-10-24 01:46:17 +08:00
ad2ed802c2dc9521f2ecfdb31aee2120
Bryan0Z
2017-10-24 01:46:27 +08:00
不是很懂,粗看了眼代码,难道不是跑一遍直接出结果嘛,是要解什么?
以及我说暗语怎么那么长,原来是段广告
nomoon
2017-10-24 01:47:21 +08:00
@Bryan0Z 我就只跑了一遍。。。2333
shiny
2017-10-24 01:51:18 +08:00
098383afb248d23da77f3e362f1acaea 只要跑出结果就可以了吧,黑线
qdwang
2017-10-24 06:31:24 +08:00
这个广告形式不错
Bryan0Z
2017-10-24 07:20:16 +08:00
8B914BC977ECDF1A6169358A94BFE463
EmbraceZ
2017-10-24 08:02:46 +08:00
标题真夸张……原来是广告
misaka19000
2017-10-24 08:35:05 +08:00
看看 Google 是怎么出题的吧,出这样的题目估计 V 友都没兴趣解
panpanpan
2017-10-24 08:54:59 +08:00
841f38baf018545c74cccdf67de60f3b
roderickzxy
2017-10-24 09:07:02 +08:00
5c4975b080a43d83eda05add64edf71f
zhangyp123
2017-10-24 09:09:06 +08:00
1b10de9a20d55e6f91bee15f55390966
roderickzxy
2017-10-24 09:14:47 +08:00
暗语:Established in 2012, Guangzhou Easyfun Information Technology Co., Ltd. is a national-certificated high-tech company, which the core members are from top-ranking internet corporations like Netease, Alibaba and Baidu. Providing Video Cloud and Live Streaming Cloud services for business, POLYV is born into a such a great company.
md5:5c4975b080a43d83eda05add64edf71f
stevedd
2017-10-24 09:20:17 +08:00
c++
md5:812bf6eb802fa541e5ea2012f90afb6e
Tenma
2017-10-24 09:22:40 +08:00
6d91dbcf646703789db547cf2317227f
lookerson
2017-10-24 09:23:28 +08:00
b10239a5c9c23833b580d3a787c37699
paul123
2017-10-24 09:25:33 +08:00
702bde0b5234a44c93f6b6833688751c
admol
2017-10-24 09:30:20 +08:00
4600e49d7051b7dd5b29c45e7615aee6
yu099
2017-10-24 09:40:04 +08:00
B3E250EA7030FB461AAA0688852199F5
zapper
2017-10-24 09:52:20 +08:00
这不 base64 嘛,哪算得上什么加密啊
7A3B750DBBFAE75BD690BB66E27C861C
pypy
2017-10-24 10:28:23 +08:00
7F8016F0DC81D19E4C00F8A43C10F5DE

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/400075

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX