From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Hongyi Zhao Newsgroups: gmane.emacs.help Subject: Search through the string's space for find the target string whose md5sum matches the required condition. Date: Tue, 12 Oct 2021 16:42:28 +0800 Message-ID: Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="40110"; mail-complaints-to="usenet@ciao.gmane.io" To: help-gnu-emacs Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Tue Oct 12 10:46:56 2021 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1maDR2-000AJy-46 for geh-help-gnu-emacs@m.gmane-mx.org; Tue, 12 Oct 2021 10:46:56 +0200 Original-Received: from localhost ([::1]:38274 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1maDR0-000461-49 for geh-help-gnu-emacs@m.gmane-mx.org; Tue, 12 Oct 2021 04:46:54 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:59880) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1maDMy-0001sf-C6 for help-gnu-emacs@gnu.org; Tue, 12 Oct 2021 04:42:47 -0400 Original-Received: from mail-ua1-x931.google.com ([2607:f8b0:4864:20::931]:34562) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1maDMv-00066n-Rm for help-gnu-emacs@gnu.org; Tue, 12 Oct 2021 04:42:43 -0400 Original-Received: by mail-ua1-x931.google.com with SMTP id h4so17254033uaw.1 for ; Tue, 12 Oct 2021 01:42:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:from:date:message-id:subject:to; bh=q8Ox/befIR6sfzLKDUyRMmJxhin0bbg1gMo1haxC5h4=; b=dSLYPjbEhyruUHmufVAftFKAKIRbpUwBz5ANIchXNhj8FAeYWyab12TmQ0FnrHZXy3 xH+h640EdiHH7V5WIe0iHwV0VGnOLDPYlhuOdiq5whLuizbiN0VGznZoRUL0ay6Q7TgE uGeMGtqUPaNQAgVC03GsoSAPHYgrpmxnHDwgnyRmREiYASoBLl6KnGjg0sGKQSk7FojS oEiWIv1HHQzi5sXFxXaGavHCVxOJGu/E1yAUJES9c3+yiGXkLw/QenRwpC6//Uklapae 62lcAYL2M7kukbrq0oXT9X659hGiuevV5YDjxNUcn7BIv9mcmO5sC7NWNpadK095xYKX /aiw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=q8Ox/befIR6sfzLKDUyRMmJxhin0bbg1gMo1haxC5h4=; b=OlE6XgvIGT59FAZFBWRpJqyadXQcnsdnrvJQFY8FxJT9FnXAqcqZ/2L+6GaXdKPlgr Zzp609dUvCS86RY87/gF4Ws4h8Iz5jNlD8JPqoL8200cExT2yNUwDhcvdT/7sn1NGi16 /ohSwpyu0jYaiIIwOVl/cQsg1cLsSZyE3ZMyd9ImbQ/NRSph/khez84Y34IBvlc8dYrr RU1GQI28f2gLtc/tCY1vTz/4cUmoz8DlpA674LcWPDCA0MKfmE/lPiy2wALPcyVjdvM3 fH4RLwioUGu0aYy1aMIlCHcZZ5i/Je0P0zRRxmQtGOaywB0rREOb5Th0AMUlk29u3J8N ghDw== X-Gm-Message-State: AOAM532KSE358B9wYdqRzpI0/8S2Z1prnF9jjbw73ckYPbQ/ThaneXsI Wy4IOm9Yr3ctHxlNgo9y9+aNalURSRVIRCF4mX1cDTWbtf2tdLzg X-Google-Smtp-Source: ABdhPJyPRT6LuhndM3sDJdU73NePhKmidkm0MrB9PbmtKAeEvEuLxe9L/NEgQHL9lruONqSCt/3diidTm+Yd2+vEATU= X-Received: by 2002:a67:a60c:: with SMTP id p12mr6602625vse.25.1634028159765; Tue, 12 Oct 2021 01:42:39 -0700 (PDT) Received-SPF: pass client-ip=2607:f8b0:4864:20::931; envelope-from=hongyi.zhao@gmail.com; helo=mail-ua1-x931.google.com X-Spam_score_int: -6 X-Spam_score: -0.7 X-Spam_bar: / X-Spam_report: (-0.7 / 5.0 requ) BAYES_05=-0.5, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "help-gnu-emacs" Xref: news.gmane.io gmane.emacs.help:133746 Archived-At: Suppose we have a string represented as follows, where `?' represents arbitrary uppercase letters: TASC?O3RJMV?WDJKX?ZM We also know that its md5sum has the following form: E903???4DAB????08?????51?80??8A? Based on the above information, find out the string and its corresponding md5sum. I've done the work with the following python code: ```python import re from hashlib import md5 from string import ascii_uppercase alphabet_uppercase=ascii_uppercase re_md5_str=re.compile(r'^E903[A-F0-9]{3}4DAB[A-F0-9]{4}08[A-F0-9]{5}51[A-F0-9]80[A-F0-9]{2}8A[A-F0-9]') #result_str=[] for i in alphabet_uppercase: i_str= 'TASC' + i for j in alphabet_uppercase: j_str = i_str + 'O3RJMV' + j for k in alphabet_uppercase: k_str = j_str + 'WDJKX' + k + 'ZM' #result_str.append(k_str) md5_str=md5(k_str.encode('utf-8')).hexdigest().upper() if re_md5_str.match(md5_str): md5_str = re_md5_str.match(md5_str)[0] print('The string: ' + k_str + '\n' + 'md5sum: ' + md5_str) ``` But I would like to know the ELISP implementation for the above question. Any hints will be greatly appreciated. Regards, HZ