Skip to content

Commit c99ef74

Browse files
committed
Use hashlib.sha256 instead of hashlib.sha1 in gcpy/regrid.py
gcpy/regrid.py - The CodeQL GitHub Action flagged the use of hashlib.sha1 as being cryptographically weak. We have adopted the recommendation of using hashlib.sha256 instead. CHANGELOG.md - Updated accordingly Signed-off-by: Bob Yantosca <yantosca@seas.harvard.edu>
1 parent b169882 commit c99ef74

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
4040
- `make_regridder_L2S --> make_regridder_ll2sg`
4141
- Updated `cstools.py`, `file_regrid.py`, `append_grid_corners.py`, and `raveller_1D.py` to import and use renamed functions
4242
- Updated `append_grid_corners.py` to use `DEFAULT_SG_PARAMS` from `constants.py`
43-
- Rema,med `vert_grid` class in `gcpy/grid.py` to `VertGrid` to conform to PascalCase naming convention
43+
- Renamed `vert_grid` class in `gcpy/grid.py` to `VertGrid` to conform to PascalCase naming convention
44+
- Replaced `hashlib.sha1` with `hashlib.sha256` in routine `sg_hash` in `gcpy/regrid.py`
4445

4546
### Fixed
4647
- Fixed grid area calculation scripts of `grid_area` in `gcpy/gcpy/cstools.py`

gcpy/regrid.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -926,7 +926,7 @@ def sg_hash(
926926
target_lat : float : Target latitude (degrees)
927927
target_lon : float : Target longitude (degrees)
928928
"""
929-
return hashlib.sha1(
929+
return hashlib.sha256(
930930
f'cs={cs_res},sf={stretch_factor:.5f},tx={target_lon:.5f},ty={target_lat:.5f}'.encode()
931931
).hexdigest()[:7]
932932

0 commit comments

Comments
 (0)