> For the complete documentation index, see [llms.txt](https://mind-expression-docs.gitbook.io/home/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://mind-expression-docs.gitbook.io/home/how-to-guides/intelligent-process/package-cryptography.md).

# Package: Cryptography

## Class: BCrypt

### Introduction

**Environment: `container`**

Bcrypt is a cryptographic hash function designed for password hashing and safe storing in the backend of applications in a way that is less susceptible to dictionary-based cyberattacks.

It accepts the following attributes

* `identifier`: the hash alogorithm identifier, it can be `'2a'` or `'2b'`. The default value is `'2b'`.
* `password`: The plain text password to be hashed.
* `round`: A numeric cost is added in front of the salt and the password hashes, showing how many password iterations were made before the hash was generate. The default value is `12`.
* `salt`: A 16-byte salt value is added in front of the plain text password, it is random by default.

After configuring the attributes, the `token` method can be leveraged to obtain the hashed password.

For example:

```smalltalk
bcrypt := BCrypt new.
bcrypt identifier: '2b'.
bcrypt password: 'password'.
bcrypt salt: #[40 38 165 61 211 214 154 81 150 63 16 222 93 78 171 1].
bcrypt round: 10.

" The hashed password can be added to a web hook's http header as follows in a talk rule: "
self httpHeaders at: 'authentication' put: bcrypt token.
```

### Instance Method

#### Category: accessing

* **`identifier`** - Get the identifier of the BCrypt.
* **`identifier:`** - Set the identifier of the BCrypt.
* **`password`** - Get the password of the BCrypt.
* **`password:`** - Set the password of the BCrypt.
* **`round`** - Get the round of the BCrypt.
* **`round:`** - Set the round of the BCrypt.
* **`salt`** - Get the salt of the BCrypt.
* **`salt:`** - Set the salt of the BCrypt.

#### Category: encode

* **`token`** - Answer the hashed password as a string.

  For example:

  ```smalltalk
  bcrypt := BCrypt new.
  bcrypt password: 'password'.
  bcrypt token.
  ```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://mind-expression-docs.gitbook.io/home/how-to-guides/intelligent-process/package-cryptography.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
