Commit 914f81e
Release Manager
sagemathgh-41546: fix issue in `to_bytes()` for finite fields
When a field had order `2^8*n` for `n >= 1` then there was an additional
byte of padding to the to_bytes encoding because of the use of `nbits`
on the order. In this PR we instead set the length from the size of the
largest element represented in the field: `order - 1`
Thanks ti @rasti37 for finding this.
Fixes sagemath#41545
URL: sagemath#41546
Reported by: Giacomo Pope
Reviewer(s): Frédéric Chapoton
1 file changed
+13
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
138 | 138 | | |
139 | 139 | | |
140 | 140 | | |
141 | | - | |
| 141 | + | |
| 142 | + | |
142 | 143 | | |
143 | 144 | | |
144 | 145 | | |
| |||
1128 | 1129 | | |
1129 | 1130 | | |
1130 | 1131 | | |
| 1132 | + | |
| 1133 | + | |
| 1134 | + | |
| 1135 | + | |
| 1136 | + | |
| 1137 | + | |
| 1138 | + | |
| 1139 | + | |
| 1140 | + | |
1131 | 1141 | | |
1132 | | - | |
| 1142 | + | |
| 1143 | + | |
1133 | 1144 | | |
1134 | 1145 | | |
1135 | 1146 | | |
| |||
0 commit comments