捕获一道难度系数为 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、活动主办方在法律允许的范围内,保留此次活动的最终解释权。

7224 次点击
所在节点    推广
78 条回复
Jack901
2017-10-24 11:02:46 +08:00
php 岂不是就几行

<?php
$YourName="1024";
$POLYV_PROPAGANDA = "RXN0YWJsaXNoZWQgaW4gMjAxMiwgR3Vhbmd6aG91IEVhc3lmdW4gSW5mb3JtYXRpb24gVGVjaG5vbG9neSBDby4sIEx0ZC4gaXMgYSBuYXRpb25hbC1jZXJ0aWZpY2F0ZWQgaGlnaC10ZWNoIGNvbXBhbnksIHdoaWNoIHRoZSBjb3JlIG1lbWJlcnMgYXJlIGZyb20gdG9wLXJhbmtpbmcgaW50ZXJuZXQgY29ycG9yYXRpb25zIGxpa2UgTmV0ZWFzZSwgQWxpYmFiYSBhbmQgQmFpZHUuIFByb3ZpZGluZyBWaWRlbyBDbG91ZCBhbmQgTGl2ZSBTdHJlYW1pbmcgQ2xvdWQgc2VydmljZXMgZm9yIGJ1c2luZXNzLCBQT0xZViBpcyBib3JuIGludG8gYSBzdWNoIGEgZ3JlYXQgY29tcGFueS4=";
$decodeStr=base64_decode($POLYV_PROPAGANDA);
echo "MD5:".md5($YourName.$decodeStr."PolyV")."<br>暗语:".$decodeStr;
?>
knva
2017-10-24 14:22:23 +08:00
王德发?
With the vision of "driving video with value",POLYV now provides great video products including Video Cloud and Live Streaming Cloud for business users.Currently, over 37,000 corporations and organizations are using POLYV ’ s video service, gaining high reputation among online education industry as well as domestic and international clients like Asian Infrastructure Investment Bank (AIIB), CCTV, Dell, Bosch & Siemens Home Appliances (BSH) and Linkedin.
md5:0D1CD7B35662583DCF7066953E3B7F9B
takanasi
2017-10-24 14:30:49 +08:00
9F044B67F0070A7AE8FE6FE7CAFCCFEA
natforum
2017-10-24 14:31:16 +08:00
Beebird
2017-10-24 14:55:50 +08:00
031f258160811a05f0c5e00a4c5dc7b5
insoxin
2017-10-24 14:58:22 +08:00
4600e49d7051b7dd5b29c45e7615aee6
Beebird
2017-10-24 15:06:12 +08:00
With the vision of "driving video with value",POLYV now provides great video products including Video Cloud and Live Streaming Cloud for business users.Currently, over 37,000 corporations and organizations are using POLYV ’ s video service, gaining high reputation among online education industry as well as domestic and international clients like Asian Infrastructure Investment Bank (AIIB), CCTV, Dell, Bosch & Siemens Home Appliances (BSH) and Linkedin.

07435145bee64a4efb28afd332a94cc3
pezy
2017-10-24 15:17:41 +08:00
C++ 版本

c47f88c27c7b12cb8eb093dd9e716c79

吐槽:1,这分明是 Qt 版本; 2,居然不给 ui 文件; 3,char val[] 里面有一个字符 "160" 应该为 "0160"...
pezy
2017-10-24 15:21:22 +08:00
补上解出的广告:POLYV is the cloud computing platform fully owned by Easyfun, including Video Cloud, Live Strewing Cloud and other video services. With complete sets of API, SDK and developer documents, the national-patented PlaySafe DRM Ecosystem, POLYV delivers stably safe ditd speedy video service for business and enterprise users.
EricFuture
2017-10-24 15:25:44 +08:00
720b6ee2309c60832844aafd500bb935
EricFuture
2017-10-24 15:29:18 +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.
CloudnuY
2017-10-24 15:34:07 +08:00
DD7FCD647C87AAF64E3AD02D31A846B5
hellpeng
2017-10-24 15:43:31 +08:00
Objective-C
POLYV, a cloud computing platform with video products, has now developed 157 features for Video Cloud, and 208 for Live Streaming Cloud (with 102 tailored for education industry). With the coming of 11.11, and in accordance with the promotion issues, POLYV will provide exclusive discounts of the year, and release service updates at the same time.
14c6de6bcc827d39b0dbe07fb7b6631b
FaiChou
2017-10-24 15:43:58 +08:00
u n d e f i n e d
mosliu
2017-10-24 15:44:06 +08:00
43d0bb4c16c57d6f3f5e8907844dd3c2
mosliu
2017-10-24 15:44:37 +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: 43d0bb4c16c57d6f3f5e8907844dd3c2
hellpeng
2017-10-24 15:47:26 +08:00
发现我是 Objective-C 的沙发呀 哈哈哈
siguretto
2017-10-24 15:51:43 +08:00
b3f51a6d39d84ee5be6d87d955e57413
csx163
2017-10-24 15:52:23 +08:00
89089d0b12970769cb819d7a4155045f
q409195961
2017-10-24 17:30:08 +08:00
ac3afcbab9f67d48f0fa818315977bdb

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

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

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

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

© 2021 V2EX