Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9021123
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T05:10:50+00:00 2026-06-16T05:10:50+00:00

I need to generate the ODIN-1 of a string in Python. The official documentation

  • 0

I need to generate the ODIN-1 of a string in Python. The official documentation specifies applying SHA-1 to the input string/identifier, but I’m not sure if I need to perform other operations to it beforehand? Also, is the final output the hex digest of the SHA-1 or something else?

E.g. How can I convert this MAC to ODIN-1 in Python? “74e2f543d2ce”

Thanks in advance!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T05:10:51+00:00Added an answer on June 16, 2026 at 5:10 am
    from hashlib import sha1
    
    def odin1(mac_addr):
        """SHA1 hexdigest of hex representaiton of MAC address"""
        to_hash ''.join([i.decode('hex') for i in mac_addr.split(':')])
        return sha1(to_hash).hexdigest()
    
    >>> odin1('1a:2b:3c:4d:5e:6f')
    '82a53f1222f8781a5063a773231d4a7ee41bdd6f'
    

    Let’s break this down, line by line between the documentation you linked to, and my answer:

    // NOTE: iOS returns MAC Address NOT a string, but a 6-byte array. 
    
    // A human readable MAC Address may be represented as the following:
    
    @"1a:2b:3c:4d:5e:6f";
    @"1A2B3C4D5E6F";
    

    In python:

    >>> '1A'.decode('hex') == '1a'.decode('hex')
    True
    

    So we can convert the string given to us into a more agreeable format (that reduces “any ambiguity around punctuation and capitalization”):

    >>> mac = "1a:2b:3c:4d:5e:6f".split(':')
    >>> hex_mac = [m.decode('hex') for m in mac]
    >>> hex_mac
    ['\x1a', '+', '<', 'M', '^', 'o']
    

    We can treat this list as a string (just the same as if we used a byte array) to get the same result from the SHA1 hash function.

    Of course, we can receive MAC addresses this way:

    >>> mac = '1A2B3C4D5E6F'
    >>> hex_chunks = lambda s: [s[i: i+2] for i in range(0, len(s), 2)]
    >>> [m.decode('hex') for m in hex_chunks(mac)]
    ['\x1a', '+', '<', 'M', '^', 'o']
    

    So it would be up to us to properly unify the input for the single function to operate across all possible forms. Regardless, our function could take either form, the end result is what matters:

    >>> sha1(''.join(['\x1a', '+', '<', 'M', '^', 'o'])).hexdigest()
    

    Will produce the correct hash (according to the link you posted).

    Hope this helps make my answer clearer.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to generate a couple of objects from lists in Javascript. In Python,
I need to generate such pattern for my input, for example: +375 29 911-91-91
I need to generate Entities/Object from selected tables - not all. Is this possible
I need to generate the following XML: <Learner xmlns=some.domain.api> <ActivationDate>1999-05-31T11:20:00</ActivationDate> <EmailAddress>String content</EmailAddress> <ExpirationDate>1999-05-31T11:20:00</ExpirationDate> <FederalId>String
I need to generate 8 random integers, but they need to be unique, aka
I need to generate all permutation of a string with selecting some of the
I need to generate Python code to be more specific IronPyton . I also
I need to generate unique record id for the given unique string. I tried
I need to generate two numbers that are NOT equal in PHP. I know
I need to generate an xml infoset but the infoset needs to contain a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.