加密(模糊)答案 [英] encrypt (obscure) answers

查看:75
本文介绍了加密(模糊)答案的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经构建了一个javascript驱动的测验。鉴于客户端脚本是不安全的,有没有办法模糊这些答案让他们无法为休闲观众提供
?例如,如果我有一个外部的js

答案文件:

quest [" 01"] = [true,false,false,false,false ];

是否有办法隐藏价值,但仍然允许js显示它。


我想,我想要的是一些算法如下:


//按摩答案

//设定实际值

quest [" 01"] = [true,false,false,false,false];


fObscure = function(oldVal){

//做点什么

返回newVal

}


quest [" 01"] = fObscure(quest [" 01"]);

//返回,比如''qwerty''和这是我在下载的

// js文件中的价值

//然后在测验中

fReveal = function(newVal ){

//做点什么

返回oldVal

}


任务[" 01" ;] = fReveal(quest [" 01"]);

//返回[true,false,false,false,false];


我我尝试过几种方法,但是我遇到了不同数据类型的问题。


再次它不会如果我正在提供带钥匙的钥匙,那就是那个随意的观众,我正抱着它。如果他们聪明,或者b $ b持续存在,或者幸运地获得答案,那么给他们长寿。


Andrew Poulos

I''ve built a javascript driven quiz. Given that client-side scripting is
not secure, is there a way to "obscure" answers so that they are
unavailable to the casual viewer? For example, If I have an external js
answer file with this in it:
quest["01"] = [true,false,false,false,false];
is there a way to "obscure" the value but still allow js to reveal it.

What I''m looking for, I guess, is some algorithm that works like this:

// Massage the answers
// set real value
quest["01"] = [true,false,false,false,false];

fObscure = function(oldVal) {
// do something
return newVal
}

quest["01"] = fObscure( quest["01"] );
// returns, say, ''qwerty'' and this is the value I put into the
// js file that gets downloaded
// Then in the quiz
fReveal = function(newVal) {
// do something
return oldVal
}

quest["01"] = fReveal( quest["01"] );
// returns [true,false,false,false,false];

I''ve tried a few ways but I''m having trouble with the different data types.

Again it doesn''t matter that I''m providing the key with the lock, it''s
just the casual viewer I''m holding at bay. If they are clever,
persistent, or lucky enough to get the answers then "long life to them".

Andrew Poulos

推荐答案

>我已经建立了一个javascript驱动的测验。鉴于客户端脚本是
> I''ve built a javascript driven quiz. Given that client-side scripting is
不安全,有没有办法隐藏?答案让他们对随意的观众不可用?
not secure, is there a way to "obscure" answers so that they are
unavailable to the casual viewer?




不可以。你永远不会相信客户,任何客户都要保守你的秘密。 />
秘密信息属于服务器。

http ://www.crockford.com/javascript


Andrew Poulos写道:
Andrew Poulos wrote:
有没有办法"晦涩"值但仍允许js显示它。
is there a way to "obscure" the value but still allow js to reveal it.




你可以通过Answ XOR Key对答案进行非常简单的加密,

显示再次使用Encr XOR Key。


实际上,我不确定是不是XOR才能解决问题......无论如何它

是一种简单形式的对称加密。当然,你必须在你的代码中提供

Key。对于那些检查你的剧本的人,只需要一点点努力就可以找到答案。



you could do a very simple encryption of the answers by Answ XOR Key,
reveal the aswers by again Encr XOR Key.

actually, i`m not sure if it was XOR that does the trick ... , anyway it
is a simple form of symetric encryption. you, of course, have to provide
the Key in your code. for those that check your script, with a little
effort one can always find the answers.


Douglas Crockford写道:< br>
Douglas Crockford wrote:
我已经构建了一个javascript驱动的测验。鉴于客户端脚本不安全,是否有办法隐藏?答案让他们对随意的观众不可用?
I''ve built a javascript driven quiz. Given that client-side scripting is
not secure, is there a way to "obscure" answers so that they are
unavailable to the casual viewer?



不可以。你永远不能相信客户,任何客户,保守秘密。
秘密信息属于服务器。

http://www.crockford.com / javascript




我想我做了一个含糊不清的评论。我知道客户端脚本

是不安全。我需要的只是让用户不仅要打开

并阅读文件以获得答案。如果他们构建电子表格并将

数据放入其中以生成答案,那就不是问题了。

Andrew Poulos



I think I made an ambiguous comment. I know that client side scripting
is "unsecure". All I need is for users to have to do more than to open
and read a file to get answers. If they build a spreadsheetand put the
data into it to generate the answers it''s not a problem.
Andrew Poulos


这篇关于加密(模糊)答案的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆