object Bcrypt extends Object with Bcrypt
Native JS implementation of BCrypt for Node. Has the same functionality as node.bcrypt.js expect for a few tiny differences. Mainly, it doesn't let you set the seed length for creating the random byte array.
I created this version due to a small problem I faced with node.bcrypt.js. Basically, to deploy one of my apps which uses node.bcrypt.js on a winx64 platform, I have to force the user to download about 1.6gb of sdks, buildtools and other requirements of which some fail to install ! Microsoft :(
This code is based on javascript-bcrypt and uses [crypto] (http://nodejs.org/api/crypto.html) to create random byte arrays.
- Annotations
- @native() @JSImport( "bcrypt" , JSImport.Namespace )
- Version
1.0.2
- See also
https://www.npmjs.com/package/bcrypt-nodejs
- Alphabetic
- By Inheritance
- Bcrypt
- Bcrypt
- Object
- Any
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Value Members
-
final
def
!=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
##(): Int
- Definition Classes
- AnyRef → Any
-
final
def
==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
asInstanceOf[T0]: T0
- Definition Classes
- Any
-
def
clone(): AnyRef
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
def
compare(data: Any, encrypted: Hash, callback: Function2[BCryptError, Boolean, Any]): Unit
Asynchronously compares the hash to the given data
Asynchronously compares the hash to the given data
- data
the given data to be compared
- encrypted
the encrypted data to be compared to.
- callback
the error/result callback
- Definition Classes
- Bcrypt
bcrypt.compare("bacon", hash, function(err, res) {})
Example: -
def
compare(data: Any, encrypted: Hash): Promise[Boolean]
Asynchronously compares the hash to the given data
Asynchronously compares the hash to the given data
- data
the given data to be compared
- encrypted
the encrypted data to be compared to.
- returns
the promise of a result
- Definition Classes
- Bcrypt
bcrypt.compare("bacon", hash)
Example: -
def
compareSync(data: Any, encrypted: Hash): Boolean
Synchronously compares the hash to the given data
Synchronously compares the hash to the given data
- data
the given data to be compared
- encrypted
the encrypted data to be compared to.
- Definition Classes
- Bcrypt
bcrypt.compareSync("veggies", hash); // false
Example: -
final
def
eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
def
equals(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
def
finalize(): Unit
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( classOf[java.lang.Throwable] )
-
def
genSalt(rounds: Int = js.native, callback: Function2[BCryptError, Salt, Any]): Unit
Asynchronously generates the salt
Asynchronously generates the salt
- rounds
the number of rounds to process the data for. (default - 10)
- callback
the error/result callback
- Definition Classes
- Bcrypt
-
def
genSalt(rounds: Int): Promise[Salt]
Asynchronously generates the salt
Asynchronously generates the salt
- rounds
the number of rounds to process the data for. (default - 10)
- returns
the generated salt
- Definition Classes
- Bcrypt
-
def
genSalt(): Promise[Salt]
Asynchronously generates the salt
-
def
genSaltSync(rounds: Int = js.native): Salt
Synchronously generates the salt
Synchronously generates the salt
- rounds
the number of rounds to process the data for. (default - 10)
- Definition Classes
- Bcrypt
bcrypt.genSaltSync(rounds)
Example: -
final
def
getClass(): Class[_]
- Definition Classes
- AnyRef → Any
-
def
getRounds(encrypted: Hash): Int
Returns the number of rounds used to encrypt a given hash
Returns the number of rounds used to encrypt a given hash
- encrypted
hash from which the number of rounds used should be extracted.
- returns
the number of rounds used to encrypt a given hash
- Definition Classes
- Bcrypt
bcrypt.getRounds(encrypted)
Example: -
def
hasOwnProperty(v: String): Boolean
- Definition Classes
- Object
-
def
hash(data: Any, salt: Salt, callback: Function2[BCryptError, Hash, Any]): Unit
Asynchronously creates a hash using the given data
Asynchronously creates a hash using the given data
- data
the given data to be hashed
- salt
the salt to be used to hash the password.
- callback
a callback to be fired once the data has been encrypted.
- Definition Classes
- Bcrypt
bcrypt.hash(data, salt, progress, cb)
Example: -
def
hash(data: Any, salt: Salt, progress: Function, callback: Function2[BCryptError, Hash, Any]): Unit
Asynchronously creates a hash using the given data
Asynchronously creates a hash using the given data
- data
the given data to be hashed
- salt
the salt to be used to hash the password.
- progress
a callback to be called during the hash calculation to signify progress
- callback
a callback to be fired once the data has been encrypted.
- Definition Classes
- Bcrypt
bcrypt.hash(data, salt, progress, cb)
Example: -
def
hash(data: Any, salt: Salt): Promise[Hash]
Asynchronously creates a hash using the given data
Asynchronously creates a hash using the given data
- data
the given data to be hashed
- salt
the salt to be used to hash the password.
- returns
the promise of the hash
- Definition Classes
- Bcrypt
bcrypt.hash(data, salt)
Example: -
def
hashCode(): Int
- Definition Classes
- AnyRef → Any
-
def
hashSync(data: Any, salt: Salt): Hash
Synchronously creates a hash using the given data
Synchronously creates a hash using the given data
- data
the given data to be hashed
- Definition Classes
- Bcrypt
bcrypt.hashSync("bacon")
Example: -
final
def
isInstanceOf[T0]: Boolean
- Definition Classes
- Any
-
def
isPrototypeOf(v: Object): Boolean
- Definition Classes
- Object
-
final
def
ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
final
def
notify(): Unit
- Definition Classes
- AnyRef
-
final
def
notifyAll(): Unit
- Definition Classes
- AnyRef
-
def
propertyIsEnumerable(v: String): Boolean
- Definition Classes
- Object
-
final
def
synchronized[T0](arg0: ⇒ T0): T0
- Definition Classes
- AnyRef
-
def
toLocaleString(): String
- Definition Classes
- Object
-
def
toString(): String
- Definition Classes
- AnyRef → Any
-
def
valueOf(): Any
- Definition Classes
- Object
-
final
def
wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )