Creating random data using cryptographic algorithms in the JavaScript library provided by MIT

Can anyone recommend a MIT licensed javascript library that can generate cryptographically random numbers? I need it to create AES 128 keys, so it has to be top-notch. I've searched online but all the libraries I found are GPL licensed, which isn't an option for me due to legal restrictions. Does anyone know of a suitable library that is either MIT licensed or even better, public?

Thank you in advance.

Answer №1

This post addresses a question that shares similarities with the topic discussed in Generating cryptographically secure pseudorandom numbers in JavaScript?.

Utilizing JavaScript within a browser:

An experimental API available in Firefox and Chrome, titled window.crypto.getRandomValues, enables this functionality.

However, employing other libraries for random number generation within a browser environment poses challenges due to the difficulty of gathering sufficient entropy. Consequently, these libraries may exhibit prolonged startup times or yield randomness of substandard quality.

Several options for random number generator libraries include:

The first two alternatives likely satisfy your licensing criteria, as the BSD license is characterized by its permissive nature. The third option has been included for comprehensive purposes.

In the context of node.js:

Referencing crypto.randomBytes

Answer №2

For those interested, a good resource to consider is crypto-js. It is BSD-licensed and has gained a strong reputation over the past 3+ years.

Answer №3

After my last search, I stumbled upon the MSR JavaScript Cryptography Library, which turned out to be exactly what I was looking for.

It's worth noting that modern browsers now have native support for some cryptography features. For example, Chrome supports cryptographically secure pseudo-random numbers, and IE11 offers even more functions: http://msdn.microsoft.com/en-us/library/ie/dn302338%28v=vs.85%29.aspx

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Creating a function within a module that takes in a relative file path in NodeJs

Currently, I am working on creating a function similar to NodeJS require. With this function, you can call require("./your-file") and the file ./your-file will be understood as a sibling of the calling module, eliminating the need to specify the full path. ...

Using jQuery to conceal the elements within a div

Hi there! I am just starting out with programming and JavaScript, and I have a fun idea for a simple memory game involving numbers. Here's how it works: when the user clicks on a button, numbers will be revealed for 5 seconds, and then they will hide ...

Tips for linking a dictionary to an Angular <p> tag in HTML

Although I have little experience with angularJS, I am struggling to find a clear explanation on how to bind a dictionary with an html tag so that any changes made in the dictionary reflect in the number displayed within the <p> tag. For instance, if ...

Tips for creating immersive 3D games on the web

I am fairly new to the world of HTML and Javascript, but I am diving into the Udacity interactive 3D course and experimenting with three.js + WebGL. I have managed to create and somewhat understand this: So far. (I am struggling to comprehend the API ...

Using Vue.js within Cordova platform allows developers to create dynamic

Having trouble integrating a Vue.js app into Cordova. Everything seems to be working fine, except I'm unsure how to capture Cordova events (deviceready, pause, etc.) within my Vue application. Using the Webpack template from vue-cli. This is my file ...

PageCallbacks in .NET 1.1

Is it possible to utilize PageMethods in .NET 1.1 for making server-side method calls from the client side? Could you provide a brief explanation on how to use this feature by calling PageMethods.MyMethod(); ? ...

Tips for choosing elements based on a specific attribute (such as fill color) in D3.js using the SelectAll method

I have various sets of circles on a map - 10 red circles, 10 blue circles, and 10 green circles. Is there a way to use d3 selectAll or select to specifically choose only the red circles? Are there any alternative methods for achieving this? The color of ...

Making an asynchronous request using Ajax to verify the status of a checkbox

I have two checkboxes, and I want to make an ajax call to a jsp page when one of the checkboxes is clicked. The jsp page should display a table with data fetched from a database. The issue arises when dealing with two checkboxes: <div class="search-in ...

Issue: $parse:syntax Syntax Error

This bug is really frustrating me and I could use some help. Oops! The Syntax Error: Token '{' is not a valid key at column 2 of the expression [{{ field }}.$error] starting at [{ field }}.$error]. form-input.html <div class='row ...

Displaying a component after retrieving a value from AsyncStorage in a React Native application

I have developed a React Component that saves user settings in the AsyncStorage and retrieves them upon loading. The functionality of storing and retrieving data is working fine, but I am facing an issue where the component renders before the values are ...

The Scribd page function is experiencing technical difficulties and is currently not functioning as

I recently added the Scribd document viewer to my website, but I am encountering an issue with the setPage function not working properly. Could someone assist me in setting it up to only display the first 2 pages of the document? Please take a look at the ...

The recursion function within the map is not defined

My coding challenge involves the following logic: export const normaliseHistoryLog = history => { if (history.children.length === 0) { debugger; return { id: history.id, date: history.timestamp, ...

Perform the unit test using *ngFor and Input

As a newcomer to Angular, I've developed a component that showcases buttons using *ngFor. The TypeScript file: import { Component, OnInit, Input } from '@angular/core'; @Component({ selector: 'display-button' ...

What steps are needed to successfully execute the generateHash function?

block.js The file block.js contains a function called generateHash, within which I am struggling to implement Promises for calculating the hash asynchronously and updating the hash property. class Block { constructor(data){ this.id = ...

Executing functions within the local scope in node.js

Scripts named index.js and utils.js I've attempted to implement the module export solution, but haven't been successful. In order to call a function from utils.js in index.js, I define the function in utils like this: export.functionName = fun ...

Difficulty encountered with document.querySelectorAll retrieving paginated elements

I am currently developing a project called STEEP. Our implementation involves utilizing infinite scroll to load 8 videos at a time as the user scrolls through the page. However, we are facing an issue with the script responsible for handling video playbac ...

What is the best way to navigate through a series of images using left and right arrows in a React

I need help implementing a feature where I can slide horizontally through a collection grid of 10 movie items per row, similar to Netflix grids. Is there an easy way to achieve this with arrows on the right and left ends? <div className="collection-p ...

Empty dropdown list displaying no options

<script> function populateDropdown() { var dropdown = document.getElementById("ddFAge"); for(var i=1;i<=100;i++) { var newOption = new Option() newOption=document.createEle ...

Modifying the State array is beyond my control

I'm facing an issue passing the codes correctly here, so I'll explain the problem using images. (REMEMBER: All these are within the same component) Issue: I have a single state value: state = { base: [ {tomato: false}, {egg: true} ], ...

typescript push in react native is a crucial step to enhance performance and optimize

I've been diving into TypeScript within the realm of React Native. Oddly, when I translated a certain snippet to vanilla JavaScript, the application worked flawlessly. However, upon converting it back to TypeScript, an error message popped up stating ...