-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Improve Secret memory usage * Refactoring Secret internal * Add isEquals
- Loading branch information
Showing
7 changed files
with
419 additions
and
147 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
config/src/main/scala/com/geirolz/app/toolkit/config/BytesUtils.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package com.geirolz.app.toolkit.config | ||
|
||
import java.nio.ByteBuffer | ||
import java.util | ||
|
||
private[config] object BytesUtils { | ||
|
||
def clearByteArray(bytes: Array[Byte]): Null = { | ||
util.Arrays.fill(bytes, 0.toByte) | ||
null | ||
} | ||
|
||
def clearByteBuffer(buffer: ByteBuffer): Null = { | ||
val zeroBytesArray = new Array[Byte](buffer.capacity()) | ||
util.Arrays.fill(zeroBytesArray, 0.toByte) | ||
buffer.clear() | ||
buffer.put(zeroBytesArray) | ||
null | ||
} | ||
} |
Oops, something went wrong.