| career | drupal | java | mac | mysql | perl | scala | uml | unix  

Akka/Scala example source code file (AES128CounterSecureRNG.scala)

This example Akka source code file (AES128CounterSecureRNG.scala) is included in my "Source Code Warehouse" project. The intent of this project is to help you more easily find Akka and Scala source code examples by using tags.

All credit for the original source code belongs to; I'm just trying to make examples easier to find. (For my Scala work, see my Scala examples and tutorials.)

Akka tags/keywords

aes128countersecurerng, aescounterrng, akka, array, instance, int, remote, securerandomseedgenerator, security, unit

The AES128CounterSecureRNG.scala Akka example source code

 * Copyright (C) 2009-2014 Typesafe Inc. <>

import org.uncommons.maths.random.{ AESCounterRNG, SecureRandomSeedGenerator }
import SeedSize.Seed128

 * This class is a wrapper around the 128-bit AESCounterRNG algorithm provided by
 * The only method used by netty ssl is engineNextBytes(bytes)
 * This RNG is good to use to prevent startup delay when you don't have Internet access to
class AES128CounterSecureRNG extends {
  /**Singleton instance. */
  private final val Instance: SecureRandomSeedGenerator = new SecureRandomSeedGenerator

   * Make sure the seed generator is provided by a SecureRandom singleton and not default 'Random'
  private val rng = new AESCounterRNG(engineGenerateSeed(Seed128))

   * This is managed internally by AESCounterRNG
  override protected def engineSetSeed(seed: Array[Byte]): Unit = ()

   * Generates a user-specified number of random bytes.
   * @param bytes the array to be filled in with random bytes.
  override protected def engineNextBytes(bytes: Array[Byte]): Unit = rng.nextBytes(bytes)

   * Unused method
   * Returns the given number of seed bytes.  This call may be used to
   * seed other random number generators.
   * @param numBytes the number of seed bytes to generate.
   * @return the seed bytes.
  override protected def engineGenerateSeed(numBytes: Int): Array[Byte] = Instance.generateSeed(numBytes)

Other Akka source code examples

Here is a short list of links related to this Akka AES128CounterSecureRNG.scala source code file:

... this post is sponsored by my books ...

#1 New Release!

FP Best Seller


new blog posts


Copyright 1998-2021 Alvin Alexander,
All Rights Reserved.

A percentage of advertising revenue from
pages under the /java/jwarehouse URI on this website is
paid back to open source projects.