Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(632)

Unified Diff: sdk/lib/_internal/js_runtime/lib/preambles/d8.js

Issue 1413923004: Implement cryptographically secure random numbers by using crypto.getRandomValues. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Fix typo in return type. Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: sdk/lib/_internal/js_runtime/lib/preambles/d8.js
diff --git a/sdk/lib/_internal/js_runtime/lib/preambles/d8.js b/sdk/lib/_internal/js_runtime/lib/preambles/d8.js
index 18823e15d9dbaa7953d439d40a6415c493b289c7..b67593a64c53dbe86522039ed7bffaef8cea8b9d 100644
--- a/sdk/lib/_internal/js_runtime/lib/preambles/d8.js
+++ b/sdk/lib/_internal/js_runtime/lib/preambles/d8.js
@@ -327,4 +327,11 @@ if (typeof global != "undefined") self = global; // Node.js.
errorCallback(error);
}
};
+
+ // Mock cryptographically secure random by using plain random.
+ self.crypto = {getRandomValues: function(array) {
+ for (var i = 0; i < array.length; i++) {
+ array[i] = Math.random() * 256;
+ }
+ }};
})(self);
« no previous file with comments | « sdk/lib/_internal/js_runtime/lib/math_patch.dart ('k') | sdk/lib/_internal/js_runtime/lib/preambles/jsshell.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698