benchmarks.wiki / Public workspace

BigCodeBench / BigCodeBench v0.1.0_hf 0d2d02e5-9c7c-58b6-9e62-35f04163342e

Problem

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

complete prompt

import json
import hashlib
import blake3

def task_func(req_data):
    """
    Hashes the specified request data with BLAKE3 and then converts it into a hexadecimal representation.
    Additionally, generates an MD5 hash of the BLAKE3 hash for demonstration purposes (not for security).
    BLAKE3 is a cryptographic hash function that is much faster than MD5 and SHA-1, while providing
    high security.

    Parameters:
        req_data (dict): The request data to be hashed. It should be a dictionary.

    Returns:
        tuple: 
            - str: The hexadecimal representation of the BLAKE3 hash of the request data.
            - str: An MD5 hash of the hexadecimal BLAKE3 representation, for demonstration.

    Requirements:
    - json
    - hashlib
    - blake3

    Examples:
    >>> blake3_hash, md5_hash = task_func({'key': 'value'})
    >>> isinstance(blake3_hash, str) and len(blake3_hash) == 64
    True
    >>> isinstance(md5_hash, str) and len(md5_hash) == 32
    True
    >>> task_func({'empty': ''})[0] != task_func({'another': 'data'})[0]
    True
    """

instruct prompt

Hashes the specified request data with BLAKE3 and then converts it into a hexadecimal representation. Additionally, generates an MD5 hash of the BLAKE3 hash for demonstration purposes (not for security). BLAKE3 is a cryptographic hash function that is much faster than MD5 and SHA-1, while providing high security.
The function should output with:
    tuple:
    str: The hexadecimal representation of the BLAKE3 hash of the request data.
    str: An MD5 hash of the hexadecimal BLAKE3 representation, for demonstration.
You should write self-contained code starting with:

Code

import json
import hashlib
import blake3
def task_func(req_data):

code prompt

Code

import json
import hashlib
import blake3
def task_func(req_data):

entry point

task_func

libs

  • hashlib
  • blake3
  • json

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