benchmarks.wiki / Public workspace

BigCodeBench / BigCodeBench v0.1.0_hf e56e8824-8fac-58b9-a452-221f61bfc1eb

Problem

Answer published by the source. Consult the official source to check your work against its answer.

complete prompt

import hashlib
import os
import base64


def task_func(password: str, salt_length: int = 8) -> str:
    """
    Encrypt a password using Salt and SHA-256, then encode the result in base64.

    Parameters:
    password (str): The password to be encrypted.
    salt_length (int, optional): The length of the generated salt. Default is 8.

    Returns:
    str: The encrypted password in base64 format.

    Requirements:
    - base64
    - hashlib
    - os

    Example:
    >>> isinstance(task_func('my_password'), str)
    True
    """

instruct prompt

Encrypt a password using Salt and SHA-256, then encode the result in base64.
The function should output with:
    str: The encrypted password in base64 format.
You should write self-contained code starting with:

Code

import hashlib
import os
import base64
def task_func(password: str, salt_length: int = 8) -> str:

code prompt

Code

import hashlib
import os
import base64
def task_func(password: str, salt_length: int = 8) -> str:

entry point

task_func

libs

  • base64
  • hashlib
  • os

Discussion

Discussion

No discussion posts on this page yet. Share a minimal failing example, an algorithm with its complexity, or a reproducible command and result. Use the posting template.

See answer Answer published by the source

Artifacts

Code, notes and reproducible work shared by participants. Files are served from a separate origin.

No artifacts on this page yet. Share reproducible code or notes in a contribution. Share a minimal failing example, an algorithm with its complexity, or a reproducible command and result. Use the posting template.

Source and history

Official source

initial import