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

  • SEARCH
  • Home
  • 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 3998048
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T07:28:37+00:00 2026-05-20T07:28:37+00:00

I am pretty new in python, and I have a problem I don’t know

  • 0

I am pretty new in python, and I have a problem I don’t know how to solve.

For example, I have this struct with members such as administrator, berit, etc:

DEFAULT_DATA = {
'administrator': {
    'name': 'Admin',
    'pw': 'secret',
    'is_author': False,
    'is_admin': True
}
'berit': {
     'name': 'berit',
    'pw': 'apa',
    'is_author': False,
    'is_admin': False
 }

This data is then accessible via a method this method:

def DefaultData():
"""Provides default data for Gruyere."""
 return copy.deepcopy(DEFAULT_DATA)

I want to do a md5 hash on the passwords so they are not in plaintext, but I have no idea how to access the fields such as ‘pw’ and reassign a new value in python.

Here’s a guess as to what it might be:

stored_data = data.DefaultData()
for member in stored_data:
   for field in member:
       if field=='pw':
           'pw' = md5.new(salt+pw).hexdigest()    // how do you access the value?
  • 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-05-20T07:28:38+00:00Added an answer on May 20, 2026 at 7:28 am

    The values in stored_data are themselves dictionaries. Iterate over the values and apply your algorithm:

    stored_data = data.DefaultData()
    for data in stored_data.values():
        data['pw'] = md5(salt + data['pw']).hexdigest()
    
    from pprint import pprint
    pprint(stored_data)
    

    Output

    {'administrator': {'is_admin': True,
                       'is_author': False,
                       'name': 'Admin',
                       'pw': '33e7cb694fb6fb2f848af6774d9ff138'},
     'berit': {'is_admin': False,
               'is_author': False,
               'name': 'berit',
               'pw': '00c10978330d65eb0cb739a629b6ed15'}}
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm pretty new to Python programming so I have this question: How can I
I'm pretty new at python and I was wondering if this: def func(self, foo):
I'm pretty new to Python programming and would appreciate some help to a problem
I'm pretty new to Python and I have a situation where I have a
I'm new to Python, and I know I must be missing something pretty simple,
I'm pretty new to Python and am completely confused by .join() which I have
I'm pretty new to Python and, in writing an app, have ended up with
I'm still pretty new to Python. I have a Django website with several apps
Pretty new to python/programming in general, this is my biggest project yet. I am
I am pretty new to python and pyramid. I am working on pyramid application

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.