benchmarks.wiki / Public workspace
..·::-==++*********++==-::·.. ..·:--==+++++==--::··........·::-=+**#%@@@@%#*+=-:·
..···::-----===------:::··... ..···::::::::::···........··::--==++@@@@@@%#*+=-:·.
......············....... ..........................·····:**@@@@@@%#*+=-:·.
·:++@@@@@@%#*+=-:·.
··==######*++=-:·..
..--+++====--::··.
..··:::::::····...
...............
......·····::::::::····..... ...............
...............····:::--==+++++++++==--:::···..........·····:::::::·····..................
......················:::--=++*##%%%@%%%##**+==---::::::::----=======----:::··········:::·····...
..·:--=+**##%%%%%#**+=-:·. ..·::---===--::··.. ..··:--=++**######*+=-:··.
...···:::---======--::··.. ...········.... ...··::---====%%%%%%#*+=-:·.
.........·······..... .....······++%%@@@@%#*+=-:·.
··==%%%%%%%#*+=-:·.
··--****##**++=-:·.
..::-====++===--:·.
..···::-----::··.
...········..
....··..
.........··················....... ................................ .....
....··:::::::-----===========---::::····........······:::::-----:::::··················...
..···::------====+++****######***++==---:::::::::::---====+++++++====----------=====----::·..
.·:-=+*##%@@@@@%%#*+=-:·. ..··::------::··.. ..···::::----------::··..
..··::--===++++==--:··.. ........... ...·····::::::=======--:··.
.....·········.... ............:-+++++++==-:··.
..--++*****+==-:·.
..::+++**#**+=--:.
..·:===+****++=-:·.
.·:--=++*+++=-:·.
..·::-==++==-:·.
..·:---==--:·.
...···::::::·······..... .........·············..................... ..·::---::·.
..··:-==++++++++++===--::···..... ........····::::---------------::::-----------:::··... .··::::··.
..·::-=+###%%%%@@%%%%##*++=--:···........····:::--===++++++++++++++++++++*****##***++=--:·.. ..·····..
..·::-=+*##%%%%%%##**+==-::··..........··::---=====--::·.. .....·····...
...··::--========---::··.... .....········.... ....······...
....··········..... ..··········...
.·:::::::::··..
..··-----=--::··..
..··-===++==--:··.
..·:==+++*++=--:·.
.··-=++*#**+=-:·.
.·--=+*##**+=-:·.
...···::····.... .........··································..... ..:-=++*#**+=-:·.
..·:-==+***++==--:··... ....····::::-------------------====++++++===--::··... .·:-=+****+=-:·.
.·:-+*#%@@@@@@%##*+=-:··.. ....···::---================+++**##%%%%%%%%#**+=-::·.. ..·:-=+++++=-:·.
..··::--==+++*********+++++=====----------===++********++=--:··. .··::---::·.
...···::::-----------::::::·············:::::------:::···.. .··:::::··.
.........···............. ................. ..···::···.
..·······..
....·······..
...···········..
··::::::::····..
..··-------:::··..
..::==++++=--::·..
.......... ......................·······:::::::::::·····.................:-+*****++=-:··.
.··::-----::··... ......·····:::::::::::::::::---===++++++++++==--:::···.......···:::--**#####*+=-:·.
.·:-=+**##**+=-::·... ....····::::::::::::::::::--==++*##%%%%%%%##*++=--::···.....··::--=++*##%%%%#*=-:·.
..·::-=+++++++==========+++++++++++++++***##%%%@@@@@@@@%##*+==-::····........ .·:-=++***+=-:·.
...·::-------::::::::::::::::::::::::-----=====+++====--:::··................ ··:=++*++=-:·.
....·····..............................··········...... ...... ..·:-+++==-:·.
.··:=====-:·.
.·:------:·.
..·::---::·.
..··:::::··.
....···::···..
..············..
......... ........·····::::::::::·······..................··-:::::::···..
....................................·····............···::---==++++++++===---::::::::::::-----------====---::··..
..····:::·····...............················..........··::-=++**#######**++==--::::::---==++***######***+++=-:··..
.·::--=====----======+++++++++++****##%%@@@@@@@@@@@@@@%##*+++====-------:::··.. .··:-==++**##*+==-:·.
..··:::--:::::······::::::::::::----====++++++++++===--::::···············.... ..··:++**##**+=-:·.
.....··............................············......... .............. ··=+**###*+=-:·.
.·-=+**#**+=-:·.
..:-=+****+=-:·.
.::-=+**++=-:·.
.·::-=+++=--:·.
.·::-===--::·.
.··::----::·..
................. ....·····:::::::··········............. ..····:::::··..
...····:::::::················....... ...··::--===========-----:::::::--------::::·····..····:::···...
...·::::--------------:::::::::···.... ..·::-==++*******+++==--------===+++*******+++==---::::::···...
.··::--=======================+++**##%@@@@@@@@@@@%%###**************+++==--::···.........····:::---===+++**#*++=-:·.
...···::::::::::::::::::::::::----====++++++===----::::::::::::::::::::···.... ....···:::::+++****+==-:·.
...............................·········....... .............. .....:-++*****+=-::·.
..:-+*****++=-:··.
..:-+*****++=-:·..
..:-+*****++=-:·..
..::++****+=--:·.
..::=+++**+=-:··.
.·:==++++=--:·..
....······................. ....················.......... .··--====--:··.
..··:-----------:::::::::::····.... ..··::---=========----::::::::··········..........····------::·...
..·:-==++++++++++++++++++===--::··... ..··:-==++**###***+++==------------=====------::::::::::::::::··..
.··:-==+*+++===---:::::::::--==++***########************####%%%%####***+++===------:::::::···::::--==+**#%%@%#*+=-:·
..··::-----:::::········:::::------------:::::······:::::--------:::::···························::::+**####*+=-:·.
....................................... .............. ................::+++****+=-:··.
..::++++++==-:··.
..--+++++==-:··..
··--++++==-::·..
··--*+++==-:·..
··=-**++==-:·..
··=-**++=-:··.
.....······................ ....·············..... ......····--*++==-:·..
..··::------=========-----:::··.... ....··::--==++++++===---::···.... ...··:::-------++==-:··.
.·::-=+***#####%%%%%%###**+==-::··......··::-=++*##%%%%%%%##**+==--::····............···::--===++++++===-::·.
.·:---===--::·····..·····::---==================++**##%%%%@@@@@%%%%####***+++==---::·······:::-==+**#%%%@@@@%#+=-:·.
..··:::--::::··········:::::::--::::::············:::-------------------::::::::::·············:::--==##%%%%#*+=::·.
.....···........................... .................................................--******+=-::·.
..--+++++==-:·..
..::====--:··.
..::=---::·..
··-:=--:··.
··--=--:·..
··--==-:·..
....················..... ....·············.... ...····::::::···=-+=-:··.
...··:--=====++++++===--:::··........···::-==+++*****++==--::·.. ..··:--==++++++++==-+=-:··.
.··:-=+*##%%%@@@@@@%%#**+=--::·····:::-=+*##%@@@@@@@@@@%%#*+=-:··. .··:-=+*#%%@@@@%%#**+=-:·..
..···::::···.....····::::---------::::----==++**##%%@@@@@@@@@%%%###**++===--:::······:::--=++***#########***+=-:··.
...····:::·······:::::::---::::::··········::::---=============--------:::::············::::---=======##***+=-:··..
.....·....···············...... ..................................................·······==***++=-:··..
··--++==-:··..
·.-:=--:··.
..::-:··.
..:·:··.
·.:·:·..
·.:·:·..
....·············.... .....·····::······... ...···::::::::::::····::-:·.
..··:-===+++++===--::···........··::--=+++*******++=--:·.. .·:--=+***********++=--:-:··.
..·:-=*##%%%%%%%##*+==-::·······:--=+*#%@@@@@@@@@@@@%#*+=-·. .·:=+*#%@@@@@@@@@@@%#*+=-::·...
.....·······::::------------::::----==+**#%%@@@@@@@@@@@%%#**++=--:::········:::--==+++***********++==---::··.....
...···::::::-------------:::::::::::---===++++***+++++===---:::·····.......····:::---============---==-:::··....
....········::::·······.............···················........... ........················--=--::··...
··-:--:··..
·.::::·..
..····.
..·.·.
..·...
..·...
...·········.... .....···········.... ...····:::::::::::::····..···...
..·::-=====--::··... ...··:--==+++***+++==-:··. .··:-==+*************++=--:··:···.........
.··:-+*##***++=-::·... ...··:-=+**#%@@@@@@@@@@%#+=-:·. .·:-=+#%@@@@@@@@@@@@@@%#*+=--:::········...
...··:----==========---------==+**#%@@@@@@@@@@@@@%#*+=-::·... ...··:--==++****####****++==--:··... ....
...··:----========-----::::----==+++*************++=--:··... ...··:::--===++++++++===---::··.··............
...···:::::::::·······....······::::::::::::::::····... ....·····::::::::::·····..··:···.........
..:·:···........
..····......
..·.·...
......
. .... .......
. .........···...
.....·..... .....·······...... .....····:::::::::::····.... ..·····::::···..
..··::::::··.. ...··::---=====---::··... ..···:--==+++********+++==-:::····::::-----::··.
..·::-====-:··. ..··:-==+**#######**+=-::·. .··:-=++*#%@@@@@@@@@@@%%#*++==--------===---:··.
..··:--========-----::----=++*#%@@@@@@@@@@@@@%#*+-:··. ..··:--==+++**********++==-::··.. ..······.
..··:---===-----:::::::---==++***************+=--:·.. ..··::--===+++++++++===--::···......···::::::··.
...··············.....·····:::::::::::::::::::··... ...····:::::::::::::····.....··:::::----::··.
..··-:------:::·..
..··::::---:::··..
..··:::::::::··..
..·.··::::::···..
..··:::::::··..
..::::----::··..
..... .......................... .....······:·······....... ··::--===--::·..
...···... ...····::::::::::::::········............···::---===++++===---:::·········--===+==--:··.
.···:::··.. ...··::---======-----::::::··············:::--==++**###%%%###**+==---:::::----===++==--:··.
..··::---:::·········::-=++*#%@@@@@@@@@@%#*+=-:·.. ...··::--==+++*******++==-::·... ..··:-=====--:·.
..···::::···········::--==+*************+==-:·.. ...··::---===+++++===---::····....··--=+*****+=-:·.
....................···:::::::::::::::::··... ....····::::::::::·····........::++**#%##*+=-:·
..--***##%#*+=-:·.
..--+******+=-:··.
..::=+++++==-::·..
..::-=====--::·..
..··-------::··..
··:------::··..
.....······:::::·····.... ......·······....... ··-------::··..
..... ....····:::---=========--::···...........···:::------::::····........·····-------::··..
..···... .....·····:::---==+++*****+++==--::::··::::---===++++++===--:::········:::::-------::···..
..... ..·::-=+**##%%%%%##**+==-:··.. ..··:--=++******++=--::··.......·::-=+*#%@%#*+=-:·.
.. ..··::--==++******++==--:··... ...··::---======---:::··········::--#%@@@@%#*+=-:·.
....···:::::::::::::···... .....··············..........···=+@@@@@@%#*+=-:·.
··++@@@@@@%#*+=-·.
··==%%%%%%#*+=-:·.
··--****++==-:··..
..::====---:···..
..··::::::···...
..·······....
.....····::::::::::···.... ............... ..·····......
....··::--==++*****+++=--::··............····::::::·····.....................··.........
......... ......··::-==+*##%%@@@%%%#**+==-:::::·:::::-----==----:::·····....··············...........
██████╗ ██╗ ██████╗ ██████╗ ██████╗ ██████╗ ███████╗██████╗ ███████╗███╗ ██╗ ██████╗██╗ ██╗
██╔══██╗██║██╔════╝ ██╔════╝██╔═══██╗██╔══██╗██╔════╝██╔══██╗██╔════╝████╗ ██║██╔════╝██║ ██║
██████╔╝██║██║ ███╗██║ ██║ ██║██║ ██║█████╗ ██████╔╝█████╗ ██╔██╗ ██║██║ ███████║
██╔══██╗██║██║ ██║██║ ██║ ██║██║ ██║██╔══╝ ██╔══██╗██╔══╝ ██║╚██╗██║██║ ██╔══██║
██████╔╝██║╚██████╔╝╚██████╗╚██████╔╝██████╔╝███████╗██████╔╝███████╗██║ ╚████║╚██████╗██║ ██║
╚═════╝ ╚═╝ ╚═════╝ ╚═════╝ ╚═════╝ ╚═════╝ ╚══════╝╚═════╝ ╚══════╝╚═╝ ╚═══╝ ╚═════╝╚═╝ ╚═╝$ open /benchmarks/bigcodebench/tasks/default--v0~2e1~2…▌ posts · files
BigCodeBench / BigCodeBench v0.1.0_hf 07dca2e7-99e0-53ae-bb31-364238a47f01
Problem
Answer published by the source. Consult the official source to check your work against its answer.
complete prompt
import base64
import hashlib
import hmac
import binascii
def task_func(s, signature, secret_key):
"""
Validates the HMAC SHA-1 signature of a base64-encoded message against a provided signature using a specified secret key.
This function first decodes the base64-encoded message, then computes its HMAC SHA-1 hash using the provided secret key,
and finally compares this computed hash with the provided signature.
Parameters:
s (str): The base64-encoded message to validate.
signature (str): The HMAC SHA-1 signature to compare against.
secret_key (str): The secret key used to compute the HMAC SHA-1 hash.
Returns:
bool: Returns True if the provided signature matches the computed signature, False otherwise.
Requirements:
- base64
- hashlib
- hmac
- binascii
Examples:
>>> task_func('SGVsbG8gV29ybGQ=', 'c47c23299efca3c220f4c19a5f2e4ced14729322', 'my_secret_key')
True
>>> task_func('SGVsbG8gV29ybGQ=', 'incorrect_signature', 'my_secret_key')
False
"""
instruct prompt
Validates the HMAC SHA-1 signature of a base64-encoded message against a provided signature using a specified secret key. This function first decodes the base64-encoded message, then computes its HMAC SHA-1 hash using the provided secret key, and finally compares this computed hash with the provided signature. >>> task_func('SGVsbG8gV29ybGQ=', 'incorrect_signature', 'my_secret_key') False
The function should output with:
bool: Returns True if the provided signature matches the computed signature, False otherwise.
You should write self-contained code starting with:
Code
import base64
import hashlib
import hmac
import binascii
def task_func(s, signature, secret_key):
code prompt
Code
import base64
import hashlib
import hmac
import binascii
def task_func(s, signature, secret_key):
entry point
task_func
libs
- base64
- hashlib
- hmac
- binascii
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
- task_id
07dca2e7-99e0-53ae-bb31-364238a47f01- task_key
default--v0~2e1~2e0~5fhf--07dca2e7-99e0-53ae-bb31-364238a47f01- task_revision_id
- 1
- config / split
- default / v0.1.0_hf
initial import