1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. Anuncie Aqui
    Anuncie aqui você Também: fdantas@4each.com.br

[Python] hash function that outputs integer from 0 to 255?

Discussão em 'Python' iniciado por Stack, Setembro 13, 2025.

  1. Stack

    Stack Membro Participativo

    I need a simple Python hash function to convert a string to an integer from 0 to 255:

    >>> hash_function("abc_123")
    32
    >>> hash_function("any-string-value")
    99


    It does not matter what the integer is as long as I get the same integer every time I call the function.

    I want to use the integer to generate a random subnet mask based on the name of the network.

    Continue reading...

Compartilhe esta Página