简体   繁体   English

crypto-js在Unity中抛出编译错误

[英]crypto-js throws compile error in Unity

I am working on an app that currently stores user passwords in plain-text. 我正在开发一个当前以纯文本形式存储用户密码的应用程序。 After a bit of research, I decided to opt for SHA3 from the crypto-js library to accomplish this task. 经过一番研究,我决定从crypto-js库中选择SHA3来完成这项任务。 I downloaded the SHA3 rollup and placed it (unmodified) in the same folder as the scripts I intended to use it in. Unity, however, immediately throws a compile error: 我下载了SHA3汇总并将其(未修改)放在与我打算使用它的脚本相同的文件夹中。但是,Unity会立即抛出编译错误:

Assets/Scripts/StartMenu/sha3.js(7,46): BCE0043: Unexpected token: ,.

Googling the error yields various issues with syntacticly incorrect code. 谷歌搜索错误会产生语法不正确的代码的各种问题。 My research led me to believe that crypto-js was the go-to implementation for js, so I doubt there's an issue with the library. 我的研究让我相信crypto-js是js的首选实现,所以我怀疑这个库存在问题。 Does Unity differ greater in it's JS implementation? Unity的JS实现是否会有更大的不同? What am I missing? 我错过了什么?

Unity is not really using JavaScript, but UnityScript. Unity并不是真正使用JavaScript,而是UnityScript。 Unityscript and Javascript are essentially different languages; Unityscript和Javascript本质上是不同的语言; it's mostly a marketing move to call it "Javascript" in Unity. 它主要是在Unity中称之为“Javascript”的营销举措。 Some of the differences can be found here and here . 这里这里可以找到一些差异。 If anything I would advice you to switch over to C#. 如果有什么我建议你切换到C#。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM